Skip to content

Commit f477e92

Browse files
mkdirs without error message; changed message formatting a bit
1 parent 0fbfa99 commit f477e92

File tree

9 files changed

+29
-30
lines changed

9 files changed

+29
-30
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = 'lol.hub'
8-
version = '4.0.2'
8+
version = '4.0.3'
99
description = 'Minecraft self-service teleport requests'
1010

1111
repositories {

src/main/java/lol/hub/hubtpa/Ignores.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ private static void save(UUID player, Set<UUID> ignores) {
4141
var path = filePath(player);
4242

4343
// create directory structure up to parent
44-
if (!path.toFile().getParentFile().mkdirs()) {
45-
Log.error(new Exception("Could not create folder for ignores."));
46-
}
44+
//noinspection ResultOfMethodCallIgnored
45+
path.toFile().getParentFile().mkdirs();
4746

4847
var json = gson.toJson(ignores);
4948

src/main/java/lol/hub/hubtpa/Plugin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ public void executeTP(Player tpTarget, Player tpRequester) {
183183
// Notify players about the pending teleport
184184
tpTarget.sendMessage(Component.text("Teleporting ", NamedTextColor.GOLD)
185185
.append(Component.text(tpRequester.getName()))
186-
.append(Component.text(" in ", NamedTextColor.GOLD))
186+
.append(Component.text(" in "))
187187
.append(Component.text(tpDelay))
188-
.append(Component.text(" seconds...", NamedTextColor.GOLD)));
188+
.append(Component.text(" seconds...")));
189189

190190
tpRequester.sendMessage(Component.text("Teleporting in ", NamedTextColor.GOLD)
191191
.append(Component.text(tpDelay))
192-
.append(Component.text(" seconds...", NamedTextColor.GOLD)));
192+
.append(Component.text(" seconds...")));
193193

194194
this.getScheduler().runLaterAsync(() -> {
195195
if (RequestManager.isRequestActive(tpTarget, tpRequester)) {
@@ -240,10 +240,10 @@ public void executeTPMove(Player tpTarget, Player tpRequester) {
240240
tpRequester.sendMessage(
241241
Component.text("Teleported to ", NamedTextColor.GOLD)
242242
.append(Component.text(tpTarget.getName()))
243-
.append(Component.text("!", NamedTextColor.GOLD)));
243+
.append(Component.text("!")));
244244
} else {
245245
TextComponent msg =
246-
Component.text("Teleport failed, you should harass your admin because of this!", NamedTextColor.RED);
246+
Component.text("Teleportation failed. Please try again later or contact an admin.", NamedTextColor.RED);
247247
tpTarget.sendMessage(msg);
248248
tpRequester.sendMessage(msg);
249249
}

src/main/java/lol/hub/hubtpa/RequestManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ static void clearOldRequests(int timeoutValue) {
2121
requester.sendMessage(
2222
Component.text("Your teleport request to ", NamedTextColor.GOLD)
2323
.append(Component.text(request.target().name()))
24-
.append(Component.text(" timed out.", NamedTextColor.GOLD))
24+
.append(Component.text(" timed out."))
2525
);
2626
}
2727
Player target = Bukkit.getPlayer(request.target().uuid());
2828
if (target != null) {
2929
target.sendMessage(
3030
Component.text("The teleport request from ", NamedTextColor.GOLD)
3131
.append(Component.text(request.requester().name()))
32-
.append(Component.text(" timed out.", NamedTextColor.GOLD))
32+
.append(Component.text(" timed out."))
3333
);
3434
}
3535
}

src/main/java/lol/hub/hubtpa/commands/AcceptCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void run(Player tpTarget, String requesterName) {
2222
tpTarget.sendMessage(
2323
Component.text("Player ", NamedTextColor.RED)
2424
.append(Component.text(requesterName))
25-
.append(Component.text(" is not online.", NamedTextColor.RED))
25+
.append(Component.text(" is not online."))
2626
);
2727
return;
2828
}
@@ -31,7 +31,7 @@ public void run(Player tpTarget, String requesterName) {
3131
tpTarget.sendMessage(
3232
Component.text("There is no request to accept from ", NamedTextColor.RED)
3333
.append(Component.text(tpRequester.getName()))
34-
.append(Component.text("!", NamedTextColor.RED))
34+
.append(Component.text("!"))
3535
);
3636
return;
3737
}
@@ -48,7 +48,7 @@ public void run(Player tpTarget, String requesterName) {
4848
.append(Component.text("accepted", NamedTextColor.GREEN))
4949
.append(Component.text(". Teleporting to ", NamedTextColor.GOLD))
5050
.append(Component.text(tpTarget.getName()))
51-
.append(Component.text(".", NamedTextColor.GOLD))
51+
.append(Component.text("."))
5252
);
5353

5454
// TODO: combine these 2 methods to a single "accept" call

src/main/java/lol/hub/hubtpa/commands/AskCmd.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public void run(Player commandSender, String targetName) {
2222
commandSender.sendMessage(
2323
Component.text("Player ", NamedTextColor.RED)
2424
.append(Component.text(targetName))
25-
.append(Component.text(" is not online.", NamedTextColor.RED))
25+
.append(Component.text(" is not online."))
2626
);
2727
return;
2828
}
2929

3030
if (Ignores.get(target.getUniqueId(), commandSender.getUniqueId())) {
3131
commandSender.sendMessage(
32-
Component.text(target.getName())
33-
.append(Component.text(" is ignoring your tpa requests!", NamedTextColor.RED))
32+
Component.text(target.getName(), NamedTextColor.RED)
33+
.append(Component.text(" is ignoring your tpa requests!"))
3434
);
3535
return;
3636
}
@@ -39,7 +39,7 @@ public void run(Player commandSender, String targetName) {
3939
commandSender.sendMessage(
4040
Component.text("You are ignoring ", NamedTextColor.RED)
4141
.append(Component.text(target.getName()))
42-
.append(Component.text(". Cannot send teleport requests.", NamedTextColor.RED))
42+
.append(Component.text(". Cannot send teleport requests."))
4343
);
4444
return;
4545
}
@@ -55,8 +55,8 @@ public void run(Player commandSender, String targetName) {
5555

5656
if (plugin.isRequestBlock(target)) {
5757
commandSender.sendMessage(
58-
Component.text(target.getName())
59-
.append(Component.text(" is currently not accepting any teleport requests!", NamedTextColor.RED))
58+
Component.text(target.getName(), NamedTextColor.RED)
59+
.append(Component.text(" is currently not accepting any teleport requests!"))
6060
);
6161
return;
6262
}
@@ -75,7 +75,7 @@ public void run(Player commandSender, String targetName) {
7575
commandSender.sendMessage(
7676
Component.text("You are too far away from ", NamedTextColor.RED)
7777
.append(Component.text(target.getName()))
78-
.append(Component.text(" to teleport!", NamedTextColor.RED))
78+
.append(Component.text(" to teleport!"))
7979
);
8080
return;
8181
}
@@ -84,7 +84,7 @@ public void run(Player commandSender, String targetName) {
8484
commandSender.sendMessage(
8585
Component.text("Please wait for ", NamedTextColor.RED)
8686
.append(Component.text(target.getName()))
87-
.append(Component.text(" to accept or deny your request.", NamedTextColor.RED))
87+
.append(Component.text(" to accept or deny your request."))
8888
);
8989
return;
9090
}
@@ -100,7 +100,7 @@ public void run(Player commandSender, String targetName) {
100100
commandSender.sendMessage(
101101
Component.text("Request sent to ", NamedTextColor.GOLD)
102102
.append(Component.text(target.getName()))
103-
.append(Component.text(".", NamedTextColor.GOLD))
103+
.append(Component.text("."))
104104
);
105105

106106
target.sendMessage(

src/main/java/lol/hub/hubtpa/commands/DenyCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void run(Player tpTarget, String requesterName) {
2222
tpTarget.sendMessage(
2323
Component.text("Player ", NamedTextColor.RED)
2424
.append(Component.text(requesterName))
25-
.append(Component.text(" is not online.", NamedTextColor.RED))
25+
.append(Component.text(" is not online."))
2626
);
2727
return;
2828
}
@@ -31,7 +31,7 @@ public void run(Player tpTarget, String requesterName) {
3131
tpTarget.sendMessage(
3232
Component.text("There is no request to deny from ", NamedTextColor.RED)
3333
.append(Component.text(tpRequester.getName()))
34-
.append(Component.text("!", NamedTextColor.RED))
34+
.append(Component.text("!"))
3535
);
3636
return;
3737
}
@@ -45,7 +45,7 @@ public void run(Player tpTarget, String requesterName) {
4545
tpRequester.sendMessage(
4646
Component.text("Your request sent to ", NamedTextColor.GOLD)
4747
.append(Component.text(tpTarget.getName()))
48-
.append(Component.text(" was", NamedTextColor.GOLD))
48+
.append(Component.text(" was"))
4949
.append(Component.text(" denied", NamedTextColor.RED))
5050
.append(Component.text("!", NamedTextColor.GOLD))
5151
);

src/main/java/lol/hub/hubtpa/commands/IgnoreCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void run(Player commandSender, String targetName) {
2222
commandSender.sendMessage(
2323
Component.text("Player ", NamedTextColor.RED)
2424
.append(Component.text(targetName))
25-
.append(Component.text(" not found.", NamedTextColor.RED))
25+
.append(Component.text(" not found."))
2626
);
2727
return;
2828
}
@@ -32,7 +32,7 @@ public void run(Player commandSender, String targetName) {
3232
commandSender.sendMessage(
3333
Component.text("No longer ignoring teleport requests from ", NamedTextColor.GOLD)
3434
.append(Component.text(targetName))
35-
.append(Component.text(".", NamedTextColor.GOLD))
35+
.append(Component.text("."))
3636
);
3737
} else {
3838
boolean success = Ignores.set(commandSender.getUniqueId(), targetUuid, true);
@@ -41,7 +41,7 @@ public void run(Player commandSender, String targetName) {
4141
commandSender.sendMessage(
4242
Component.text("Ignoring teleport requests from ", NamedTextColor.GOLD)
4343
.append(Component.text(targetName))
44-
.append(Component.text(".", NamedTextColor.GOLD))
44+
.append(Component.text("."))
4545
);
4646
} else {
4747
commandSender.sendMessage(

src/main/java/lol/hub/hubtpa/commands/TpCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public int getArgumentCount() {
2828
public abstract void run(Player commandSender, String targetName);
2929

3030
public void sendUsage(Player player) {
31-
player.sendMessage(Component.text(usage, NamedTextColor.GOLD));
31+
player.sendMessage(Component.text("Usage: " + usage, NamedTextColor.GOLD));
3232
}
3333
}

0 commit comments

Comments
 (0)