Skip to content

Commit 653c55f

Browse files
committed
v5.2 - fixed #16 & fixed #17
1 parent 90379aa commit 653c55f

File tree

9 files changed

+135
-178
lines changed

9 files changed

+135
-178
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
<img src="https://github.com/czQery/ToolKit/blob/master/banner.png?raw=true" alt="Logo">
33
</div>
44

5-
[![Version](https://img.shields.io/badge/version-v5.1-informational.svg)](https://github.com/czQery/ToolKit/releases)
6-
[![Releases](https://img.shields.io/badge/download-1.21.11-brightgreen.svg)](https://github.com/czQery/ToolKit/releases/latest/download/ToolKit-5.1.jar)
5+
[![Version](https://img.shields.io/badge/version-v5.2-informational.svg)](https://github.com/czQery/ToolKit/releases)
6+
[![Releases](https://img.shields.io/badge/download-1.21.11-brightgreen.svg)](https://github.com/czQery/ToolKit/releases/latest/download/ToolKit-5.2.jar)
77

8-
>
9-
Optional dependencies: [Apollo](https://github.com/LunarClient/Apollo), [Pl3xMap](https://github.com/granny/Pl3xMap)
8+
> Optional dependencies: [Apollo](https://github.com/LunarClient/Apollo), [Pl3xMap](https://github.com/granny/Pl3xMap)
109
1110
ToolKit is a lightweight plugin for Paper & Folia servers that provides a range of useful tools for server
1211
administrators.<br>

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group = "cz.qery"
2-
version = "5.1"
2+
version = "5.2"
33

44
kotlin {
55
jvmToolchain(21)

src/main/java/cz/qery/toolkit/commands/Crash.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import cz.qery.toolkit.Main;
44
import cz.qery.toolkit.helper.Other;
55
import cz.qery.toolkit.loader.Commands;
6-
import cz.qery.toolkit.loader.CommandsBlock;
7-
import org.bukkit.Bukkit;
86
import org.bukkit.command.Command;
97
import org.bukkit.command.CommandExecutor;
108
import org.bukkit.command.CommandSender;
@@ -43,14 +41,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
4341
return false;
4442
}
4543

46-
Bukkit.getAsyncScheduler().runNow(plugin, (task) -> {
47-
try {
48-
Other.crash(target);
49-
sender.sendMessage(Other.Tools.chat(b + "[" + n + "CRASH" + b + "]" + t + " Player " + h + target.getName() + t + " has been crashed!"));
50-
} catch (InterruptedException e) {
51-
sender.sendMessage(Other.Tools.chat(b + "[" + n + "CRASH" + b + "]&c Failed to crash player " + h + target.getName()));
52-
}
53-
});
44+
try {
45+
Other.crash(target);
46+
sender.sendMessage(Other.Tools.chat(b + "[" + n + "CRASH" + b + "]" + t + " Player " + h + target.getName() + t + " has been crashed!"));
47+
} catch (InterruptedException e) {
48+
sender.sendMessage(Other.Tools.chat(b + "[" + n + "CRASH" + b + "]&c Failed to crash player " + h + target.getName()));
49+
}
5450

5551
return false;
5652
}

src/main/java/cz/qery/toolkit/commands/Crawl.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cz.qery.toolkit.Main;
44
import cz.qery.toolkit.helper.Other;
55
import cz.qery.toolkit.loader.Commands;
6+
import org.bukkit.Bukkit;
67
import org.bukkit.Location;
78
import org.bukkit.Material;
89
import org.bukkit.command.Command;
@@ -61,9 +62,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
6162
target.setMetadata("crawl", new FixedMetadataValue(plugin, true));
6263
Other.bMap.put(target.getUniqueId(), new Location[]{loc});
6364
sender.sendMessage(Other.Tools.chat(b + "[" + n + "CRAWL" + b + "]" + t + " Crawl mode has been turned &aON" + t + "!"));
64-
if (loc.getBlock().isEmpty()) {
65-
loc.getBlock().setType(Material.BARRIER);
66-
}
65+
Bukkit.getRegionScheduler().execute(plugin, loc, () -> {
66+
if (loc.getBlock().isEmpty()) {
67+
loc.getBlock().setType(Material.BARRIER);
68+
}
69+
});
6770
} else {
6871
sender.sendMessage(Other.Tools.chat(b + "[" + n + "CRAWL" + b + "]" + t + " " + who + " must stand on a full block or lower than slab!"));
6972
}

src/main/java/cz/qery/toolkit/commands/PInfo.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
4343
Player finalTarget = target;
4444
Bukkit.getAsyncScheduler().runNow(plugin, (task) -> {
4545
String name = finalTarget.getName();
46+
String uuid = finalTarget.getUniqueId().toString();
4647
String ip = Objects.requireNonNull(finalTarget.getAddress()).getHostName();
4748
String client;
4849
String trueclient = null;
@@ -59,7 +60,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
5960

6061
sender.sendMessage(Other.Tools.chat(b + "[" + n + "PlayerInfo" + b + "]"));
6162
sender.sendMessage(Other.Tools.chat(b + "- " + t + "Username " + h + name));
62-
sender.sendMessage(Other.Tools.chat(b + "- " + t + "Ip " + h + ip));
63+
sender.sendMessage(Other.Tools.chat(b + "- " + t + "UUID " + h + uuid));
64+
sender.sendMessage(Other.Tools.chat(b + "- " + t + "IP " + h + ip));
6365
if (trueclient != null) {
6466
sender.sendMessage(Other.Tools.chat(b + "- " + t + "Client " + h + client + " (" + trueclient + ")"));
6567
} else {

src/main/java/cz/qery/toolkit/commands/Sit.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,30 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
5454
}
5555

5656
if ((!Objects.equals(target.getMetadata("sit").toString(), "[]") && target.getMetadata("sit").getFirst().asInt() == 0) || Objects.equals(target.getMetadata("sit").toString(), "[]")) {
57-
if (target.isOnGround()) {
58-
Location loc = new Location(target.getWorld(), target.getLocation().getBlockX() + 0.5, target.getLocation().getBlockY() - 0.96 + target.getLocation().getY() % 1, target.getLocation().getBlockZ() + 0.5);
59-
loc.setYaw(target.getLocation().getYaw());
60-
ArmorStand as = loc.getWorld().spawn(loc, ArmorStand.class);
61-
as.setBasePlate(false);
62-
as.setArms(false);
63-
as.setVisible(false);
64-
as.setCanPickupItems(false);
65-
as.setGravity(false);
66-
as.setSmall(true);
67-
as.setPassenger(target);
68-
target.setMetadata("sit", new FixedMetadataValue(plugin, as.getEntityId()));
57+
target.getScheduler().execute(plugin, () -> {
58+
if (target.isOnGround()) {
59+
Location loc = new Location(target.getWorld(), target.getLocation().getBlockX() + 0.5, target.getLocation().getBlockY() - 0.96 + target.getLocation().getY() % 1, target.getLocation().getBlockZ() + 0.5);
60+
loc.setYaw(target.getLocation().getYaw());
61+
ArmorStand as = loc.getWorld().spawn(loc, ArmorStand.class);
62+
as.setBasePlate(false);
63+
as.setArms(false);
64+
as.setVisible(false);
65+
as.setCanPickupItems(false);
66+
as.setGravity(false);
67+
as.setSmall(true);
68+
as.setPassenger(target);
69+
target.setMetadata("sit", new FixedMetadataValue(plugin, as.getEntityId()));
6970

70-
String msgOn = Other.Tools.chat(b + "[" + n + "SIT" + b + "]" + t + " Sit mode has been turned &aON" + t + "!");
71-
target.sendMessage(msgOn);
71+
String msgOn = Other.Tools.chat(b + "[" + n + "SIT" + b + "]" + t + " Sit mode has been turned &aON" + t + "!");
72+
target.sendMessage(msgOn);
7273

73-
if (!target.getName().equals(sender.getName())) {
74-
sender.sendMessage(msgOn);
74+
if (!target.getName().equals(sender.getName())) {
75+
sender.sendMessage(msgOn);
76+
}
77+
} else {
78+
sender.sendMessage(Other.Tools.chat(b + "[" + n + "SIT" + b + "]" + t + " " + who + " must stand on a block!"));
7579
}
76-
} else {
77-
sender.sendMessage(Other.Tools.chat(b + "[" + n + "SIT" + b + "]" + t + " " + who + " must stand on a block!"));
78-
}
80+
}, null, 0);
7981
} else {
8082
Other.sCheck(target);
8183

0 commit comments

Comments
 (0)