Skip to content
Closed
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.untamedears</groupId>
<artifactId>JukeAlert</artifactId>
<packaging>jar</packaging>
<version>1.4.4</version>
<version>1.4.8</version>
<name>JukeAlert</name>
<url>https://github.com/DevotedMC/JukeAlert/</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;

import vg.civcraft.mc.civmodcore.command.PlayerCommand;
import vg.civcraft.mc.namelayer.permission.PermissionType;

Expand Down Expand Up @@ -38,10 +42,28 @@ public boolean execute(CommandSender sender, String[] args) {
}
Snitch snitch = findLookingAtOrClosestSnitch(player, PermissionType.getPermission("RENAME_SNITCH"));
if (snitch != null) {
JukeAlert plugin = JukeAlert.getInstance();
plugin.getJaLogger().updateSnitchName(snitch, name);
snitch.setName(name);
sender.sendMessage(ChatColor.AQUA + " Changed snitch name to " + name);
String prevName = snitch.getName();
if (prevName == null) {
prevName = "";
}
JukeAlert plugin = JukeAlert.getInstance();
plugin.getJaLogger().updateSnitchName(snitch, name);
snitch.setName(name);

String snitchWorld = "";
if (snitch.getLoc() != null && snitch.getLoc().getWorld() != null && snitch.getLoc().getWorld().getName() != null) {
snitchWorld = snitch.getLoc().getWorld().getName();
}
String snitchGroup = "";
if (snitch.getGroup() != null && snitch.getGroup().getName() != null) {
snitchGroup = snitch.getGroup().getName();
}
String snitchLocation = "[" + snitch.getX() + " " + snitch.getY() + " " + snitch.getZ() + "]";
TextComponent lineText = new TextComponent(ChatColor.AQUA + " Changed snitch name to " + name);
String hoverText = String.format("World: %s\nLocation: %s\nGroup: %s\nPrevious name:\n %s\nNew name:\n %s",
snitchWorld, snitchLocation, snitchGroup, prevName, name);
lineText.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hoverText).create()));
player.spigot().sendMessage(lineText);
}
return true;
} else {
Expand Down