Add minimessage placeholders
This commit is contained in:
parent
b785539ae5
commit
891e88b895
|
|
@ -29,6 +29,7 @@ import me.ryanhamshire.GriefPrevention.alttd.util.SafeZone;
|
||||||
import me.ryanhamshire.GriefPrevention.events.PreventBlockBreakEvent;
|
import me.ryanhamshire.GriefPrevention.events.PreventBlockBreakEvent;
|
||||||
import me.ryanhamshire.GriefPrevention.events.SaveTrappedPlayerEvent;
|
import me.ryanhamshire.GriefPrevention.events.SaveTrappedPlayerEvent;
|
||||||
import me.ryanhamshire.GriefPrevention.events.TrustChangedEvent;
|
import me.ryanhamshire.GriefPrevention.events.TrustChangedEvent;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
|
|
@ -2469,9 +2470,13 @@ public class GriefPrevention extends JavaPlugin
|
||||||
player.sendMiniMessage(Config.PlayerNotSpecified, null); // todo placeholders.
|
player.sendMiniMessage(Config.PlayerNotSpecified, null); // todo placeholders.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
List<Template> templates = new ArrayList<>(List.of(
|
||||||
|
Template.template("target", args[0]),
|
||||||
|
Template.template("player", player.name())
|
||||||
|
));
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
player.sendMiniMessage(Config.PlayerOffline, null); // todo placeholders.
|
player.sendMiniMessage(Config.PlayerOffline, templates); // todo placeholders.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (player.equals(target)) {
|
if (player.equals(target)) {
|
||||||
|
|
@ -2480,17 +2485,18 @@ public class GriefPrevention extends JavaPlugin
|
||||||
}
|
}
|
||||||
Claim claim = this.dataStore.getClaimAt(target.getLocation(), true, null);
|
Claim claim = this.dataStore.getClaimAt(target.getLocation(), true, null);
|
||||||
if (claim == null || (claim.checkPermission(player, ClaimPermission.Manage, null) != null)) {
|
if (claim == null || (claim.checkPermission(player, ClaimPermission.Manage, null) != null)) {
|
||||||
player.sendMiniMessage(Config.TargetNotInClaim, null); // todo placeholders.
|
player.sendMiniMessage(Config.TargetNotInClaim, templates); // todo placeholders.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
templates.add(Template.template("claim_owner", claim.getOwnerName()));
|
||||||
SafeZone zone = new SafeZone(claim);
|
SafeZone zone = new SafeZone(claim);
|
||||||
if ((target.hasPermission("griefprevention.adminclaims") && claim.isAdminClaim()) || zone
|
if ((target.hasPermission("griefprevention.adminclaims") && claim.isAdminClaim()) || zone
|
||||||
.hasTrust(target.getUniqueId())) {
|
.hasTrust(target.getUniqueId())) {
|
||||||
player.sendMiniMessage(Config.CannotKickTrustedTarget, null); // todo placeholders.
|
player.sendMiniMessage(Config.CannotKickTrustedTarget, templates); // todo placeholders.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (target.hasPermission("griefprevention.kickfromclaimexempt")) {
|
if (target.hasPermission("griefprevention.kickfromclaimexempt")) {
|
||||||
player.sendMiniMessage(Config.CannotKickExemptTarget, null); // todo placeholders.
|
player.sendMiniMessage(Config.CannotKickExemptTarget, templates); // todo placeholders.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
zone.testForSafeSpot();
|
zone.testForSafeSpot();
|
||||||
|
|
@ -2501,7 +2507,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
if (target.isInsideVehicle()) target.leaveVehicle();
|
if (target.isInsideVehicle()) target.leaveVehicle();
|
||||||
target.teleport(safe);
|
target.teleport(safe);
|
||||||
Bukkit.getPluginManager().callEvent(new PlayerTeleportEvent(target, safe, safe));
|
Bukkit.getPluginManager().callEvent(new PlayerTeleportEvent(target, safe, safe));
|
||||||
player.sendMiniMessage(Config.KickSuccess, null); // todo placeholders.
|
player.sendMiniMessage(Config.KickSuccess, templates); // todo placeholders.
|
||||||
target.sendMiniMessage(Config.KickedFromClaim, null); // todo placeholders.
|
target.sendMiniMessage(Config.KickedFromClaim, null); // todo placeholders.
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -176,14 +176,14 @@ public class Config extends AbstractConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String PlayerNotSpecified = "<red>You must specify a player.";
|
public static String PlayerNotSpecified = "<red>You must specify a player.";
|
||||||
public static String PlayerOffline = "<red>There isn't anyone online with <white>{INPUT} <red>in their name!";
|
public static String PlayerOffline = "<red>There isn't anyone online with <white><target> <red>in their name!";
|
||||||
public static String CannotKickSelf = "<red>You cannot kick yourself!";
|
public static String CannotKickSelf = "<red>You cannot kick yourself!";
|
||||||
public static String TargetNotInClaim = "<red>{TARGET} is not inside of any claims that you control!";
|
public static String TargetNotInClaim = "<red><target> is not inside of any claims that you control!";
|
||||||
public static String CannotKickTrustedTarget = "<red>{TARGET} has trust in the claims they're in, therefore they cannot be kicked!";
|
public static String CannotKickTrustedTarget = "<red><target> has trust in the claims they're in, therefore they cannot be kicked!";
|
||||||
public static String CannotKickExemptTarget = "<red>{TARGET} cannot be kicked from claims.";
|
public static String CannotKickExemptTarget = "<red><target> cannot be kicked from claims.";
|
||||||
public static String KickSuccess = "<green>{TARGET} was successfully kicked from the claim!";
|
public static String KickSuccess = "<green><target> was successfully kicked from the claim!";
|
||||||
public static String NoSafeLocation = "<red>Kick Unsuccessful... No Safe Location Available!"; // send to spawn?
|
public static String NoSafeLocation = "<red>Kick Unsuccessful... No Safe Location Available!"; // send to spawn?
|
||||||
public static String KickedFromClaim = "{PLAYER} <yellow>has kicked you out of {CLAIM_OWNER}'s claim!";
|
public static String KickedFromClaim = "<player> <yellow>has kicked you out of <claim_owner>'s claim!";
|
||||||
private static void kickFromClaimMessages() {
|
private static void kickFromClaimMessages() {
|
||||||
PlayerNotSpecified = config.getString("kickfromclaim.PlayerNotSpecified", PlayerNotSpecified);
|
PlayerNotSpecified = config.getString("kickfromclaim.PlayerNotSpecified", PlayerNotSpecified);
|
||||||
PlayerOffline = config.getString("kickfromclaim.PlayerOffline", PlayerOffline);
|
PlayerOffline = config.getString("kickfromclaim.PlayerOffline", PlayerOffline);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user