Skip to content

Initial Gui support(hard coded English for the time being)#458

Open
jerzean wants to merge 1 commit intoespidev:masterfrom
jerzean:master
Open

Initial Gui support(hard coded English for the time being)#458
jerzean wants to merge 1 commit intoespidev:masterfrom
jerzean:master

Conversation

@jerzean
Copy link
Collaborator

@jerzean jerzean commented Jan 30, 2026

still may be a bug or 3

Please look this over and let me know if you see anything obvious

@jerzean jerzean requested a review from espidev January 30, 2026 05:47
@DimaSergeew
Copy link

top

@DimaSergeew
Copy link

Can you add holograms above the blocks?

depend: [WorldGuard, WorldEdit]
softdepend: [Vault, PlaceholderAPI, LuckPerms]
main: dev.espi.protectionstones.ProtectionStones
api-version: 1.21.10
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably unintended, we shouldn't lower the api-version

"protectionstones"
]


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line?

# "blacklist" mode prevents this protect block from being used in the worlds in "worlds"
# "whitelist" mode allows this protect block to only be used in the worlds in "worlds"
# Can be overridden with protectionstones.admin permission (including OP)!
# Can be overriden with protectionstones.admin permission (including OP)!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "overridden", not overriden

public class ProtectionStones extends JavaPlugin {
// change this when the config version goes up
public static final int CONFIG_VERSION = 16;
public static final int CONFIG_VERSION = 19;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we are bumping versions from 16 -> 19? We can just bump to 17

ProtectionStones.config.set("gui.commands.tp", true);
ProtectionStones.config.set("gui.commands.unclaim", true);
ProtectionStones.config.set("gui.commands.priority", true);
ProtectionStones.config.setComment("gui.commands", " Per-command GUI toggles (only used if gui.enabled = true).\n Supported: home, flag, add, remove, addowner, removeowner, list, info, tp, unclaim, priority");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we're setting the same comment 3 times?

* Unclaims a region (returns protection stone items if configured, then deletes the region).
* This mirrors the behavior in ArgUnclaim.
*/
public static boolean unclaimRegion(PSRegion r, Player p) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we share the same implementation with /ps unclaim?

Comment on lines +168 to +219
if (mode == Mode.REMOVE_OWNER) {
if (target.equals(viewer.getUniqueId()) && region.getOwners().size() <= 1) {
PSL.msg(viewer, PSL.CANNOT_REMOVE_YOURSELF_LAST_OWNER.msg());
return;
}
}

// Apply (async like original command implementation)
Bukkit.getScheduler().runTaskAsynchronously(ProtectionStones.getInstance(), () -> {
String name = safeName(target);

switch (mode) {
case ADD_MEMBER -> {
if (region.isMember(target) || region.isOwner(target)) {
PSL.msg(viewer, "&e" + name + " &7is already added.");
return;
}
region.addMember(target);
PSL.msg(viewer, PSL.ADDED_TO_REGION.msg().replace("%player%", name));
Bukkit.getScheduler().runTaskAsynchronously(ProtectionStones.getInstance(), () -> UUIDCache.storeWGProfile(target, name));
}
case REMOVE_MEMBER -> {
if (!region.isMember(target)) {
PSL.msg(viewer, "&e" + name + " &7is not a member.");
return;
}
region.removeMember(target);
PSL.msg(viewer, PSL.REMOVED_FROM_REGION.msg().replace("%player%", name));
}
case ADD_OWNER -> {
if (region.isOwner(target)) {
PSL.msg(viewer, "&e" + name + " &7is already an owner.");
return;
}
// limit checks (reuse existing logic)
ArgAddRemove helper = new ArgAddRemove();
if (helper.determinePlayerSurpassedLimit(viewer, Collections.singletonList(region), PSPlayer.fromUUID(target))) {
return;
}
region.addOwner(target);
PSL.msg(viewer, PSL.ADDED_TO_REGION.msg().replace("%player%", name));
Bukkit.getScheduler().runTaskAsynchronously(ProtectionStones.getInstance(), () -> UUIDCache.storeWGProfile(target, name));
}
case REMOVE_OWNER -> {
if (!region.isOwner(target)) {
PSL.msg(viewer, "&e" + name + " &7is not an owner.");
return;
}
region.removeOwner(target);
PSL.msg(viewer, PSL.REMOVED_FROM_REGION.msg().replace("%player%", name));
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we could use the same implementation as /ps add/remove/addowner/removeowner, with an extracted helper function?

import java.util.function.Supplier;

/** Inventory menu for /ps admin. Executes selected actions after confirmation. */
public class AdminMenuGui extends BaseGui {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I'm a bit unsure of whether we should have a /ps admin GUI at all, they are supposed to be for server administators and some of the commands are quite destructive, so I wouldn't make it too easy to use

String tx = ChatColor.AQUA + "> " + ChatColor.GRAY + bc;
String baseCommand = ProtectionStones.getInstance().getConfigOptions().base_command;
String bc = "/" + baseCommand;
String tx = ChatColor.AQUA + "> " + ChatColor.GRAY + "/" + bc;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to cause double slashes?

tx + " admin version",
"Show the version number of the plugin.\n\n" + bc + " admin version",
bc + " admin version",
baseCommand + " admin version",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to now miss a slash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants