Skip to content
Permalink
Browse files

Add TP button to /rg list where applicable.

  • Loading branch information...
wizjany committed Jun 30, 2019
1 parent 4ff42c8 commit 254b85d1789d7c0f10098c6947339138e6318097
@@ -33,6 +33,7 @@
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;

@@ -260,6 +261,12 @@ public Component getComponent(int number) {
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND,
"/rg info -w " + world + " " + entry.region.getId()))));
}
if (perms != null && entry.region.getFlag(Flags.TELE_LOC) != null && perms.mayTeleportTo(entry.region)) {
builder.append(TextComponent.space().append(TextComponent.of("[TP]", TextColor.GRAY)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click for teleport")))
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND,
"/rg tp -w " + world + " " + entry.region.getId()))));
}
return builder.build();
}

0 comments on commit 254b85d

Please sign in to comment.
You can’t perform that action at this time.