Skip to content

Commit

Permalink
1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed Jul 7, 2024
1 parent 6ef46df commit dc304a2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxGraves</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
<packaging>jar</packaging>

<name>AxGraves</name>
Expand Down Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>com.artillexstudios.axapi</groupId>
<artifactId>axapi</artifactId>
<version>1.4.259</version>
<version>1.4.280</version>
<scope>compile</scope>
<classifier>all</classifier>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.artillexstudios.axgraves.commands;

import com.artillexstudios.axapi.utils.PaperUtils;
import com.artillexstudios.axapi.utils.StringUtils;
import com.artillexstudios.axgraves.commands.subcommands.SubCommandList;
import com.artillexstudios.axgraves.commands.subcommands.SubCommandReload;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import revxrsal.commands.annotation.Command;
Expand Down Expand Up @@ -34,4 +37,10 @@ public void reload(@NotNull Player sender) {
public void list(@NotNull Player sender) {
new SubCommandList().subCommand(sender);
}

@Subcommand("tp")
@CommandPermission("axgraves.tp")
public void tp(@NotNull Player sender, World world, double x, double y, double z) {
PaperUtils.teleportAsync(sender, new Location(world, x, y, z));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import com.artillexstudios.axapi.utils.StringUtils;
import com.artillexstudios.axgraves.grave.Grave;
import com.artillexstudios.axgraves.grave.SpawnedGraves;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;

import static com.artillexstudios.axgraves.AxGraves.CONFIG;
Expand All @@ -28,7 +32,19 @@ public void subCommand(@NotNull CommandSender sender) {
for (Grave grave : SpawnedGraves.getGraves()) {
if (!sender.hasPermission("axgraves.list.other") && sender instanceof Player && grave.getPlayer().getUniqueId() != ((Player) sender).getUniqueId()) continue;
final Location l = grave.getLocation();
MESSAGEUTILS.sendFormatted(sender, MESSAGES.getString("grave-list.grave"), Map.of("%player%", grave.getPlayerName(), "%world%", l.getWorld().getName(), "%x%", "" + l.getBlockX(), "%y%", "" + l.getBlockY(), "%z%", "" + l.getBlockZ(), "%time%", StringUtils.formatTime(dTime != -1 ? (dTime * 1_000L - (System.currentTimeMillis() - grave.getSpawned())) : System.currentTimeMillis() - grave.getSpawned())));

final Map<String, String> map = Map.of("%player%", grave.getPlayerName(),
"%world%", l.getWorld().getName(),
"%x%", "" + l.getBlockX(),
"%y%", "" + l.getBlockY(),
"%z%", "" + l.getBlockZ(),
"%time%", StringUtils.formatTime(dTime != -1 ? (dTime * 1_000L - (System.currentTimeMillis() - grave.getSpawned())) : System.currentTimeMillis() - grave.getSpawned()));

BaseComponent[] text = TextComponent.fromLegacyText(StringUtils.formatToString(MESSAGES.getString("grave-list.grave"), new HashMap<>(map)));
for (BaseComponent component : text) {
component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/axgraves tp %s %f %f %f", l.getWorld().getName(), l.getX(), l.getY(), l.getZ())));
}
sender.spigot().sendMessage(text);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class PlayerInteractListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onInteract(@NotNull PlayerInteractEvent event) {
if (event.getClickedBlock() == null) return;
if (event.getHand() == null) return;

for (Grave grave : SpawnedGraves.getGraves()) {
if (!grave.getLocation().getBlock().equals(event.getClickedBlock())) continue;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ death-message:

grave-list:
header: "&#FF00FF&l=== GRAVES ==="
grave: "&#FFAAFF%player% &7- &#FFAAFF%world% %x%, %y%, %z% &7(%time%)"
grave: "&#FF00FF[TP] &#FFAAFF%player% &7- &#FFAAFF%world% %x%, %y%, %z% &7(%time%)"
no-graves: "&#FFAAFFThere are no graves!"

update-notifier: "&#FF00FFThere is a new version of the plugin available! &#DDDDDD(&#FFFFFFcurrent: &#FF0000%current% &#DDDDDD| &#FFFFFFlatest: &#00FF00%latest%&#DDDDDD)"
update-notifier: "&#FF88FFThere is a new version of the plugin available! &#DDDDDD(&#FFFFFFcurrent: &#FF0000%current% &#DDDDDD| &#FFFFFFlatest: &#00FF00%latest%&#DDDDDD)"

# do not edit
version: 4

0 comments on commit dc304a2

Please sign in to comment.