mirror of
https://github.com/kaboomserver/extras.git
synced 2024-10-31 16:59:24 +00:00
Replace string concatenation with appending text components (#325)
* Replace string concatenation with appending text
* Fix inconsistent indentation
oops
* indentation
i forgor 💀
This commit is contained in:
parent
03a2fec6f4
commit
a1007853dd
|
@ -46,15 +46,20 @@ public final class CommandJumpscare implements CommandExecutor {
|
|||
final Player target = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (target == null) {
|
||||
sender.sendMessage(Component
|
||||
.text("Player \"" + args[0] + "\" not found"));
|
||||
sender.sendMessage(
|
||||
Component.text("Player \"")
|
||||
.append(Component.text(args[0]))
|
||||
.append(Component.text("\" not found"))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
createJumpscare(target);
|
||||
sender.sendMessage(Component
|
||||
.text("Successfully created jumpscare for player \""
|
||||
+ target.getName() + "\""));
|
||||
sender.sendMessage(
|
||||
Component.text("Successfully created jumpscare for player \"")
|
||||
.append(Component.text(target.getName()))
|
||||
.append(Component.text("\""))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,19 +32,27 @@ public final class CommandPumpkin implements CommandExecutor {
|
|||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
placePumpkin(onlinePlayer);
|
||||
}
|
||||
sender.sendMessage("Everyone is now a pumpkin");
|
||||
sender.sendMessage(Component.text("Everyone is now a pumpkin"));
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player target = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (target == null) {
|
||||
sender.sendMessage("Player \"" + args[0] + "\" not found");
|
||||
sender.sendMessage(
|
||||
Component.text("Player \"")
|
||||
.append(Component.text(args[0]))
|
||||
.append(Component.text("\" not found"))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
placePumpkin(target);
|
||||
sender.sendMessage("Player \"" + target.getName() + "\" is now a pumpkin");
|
||||
sender.sendMessage(
|
||||
Component.text("Player \"")
|
||||
.append(Component.text(target.getName()))
|
||||
.append(Component.text("\" is now a pumpkin"))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,8 +64,11 @@ public final class CommandUsername implements CommandExecutor {
|
|||
player.setPlayerProfile(profile);
|
||||
millis = System.currentTimeMillis();
|
||||
|
||||
player.sendMessage(Component
|
||||
.text("Successfully set your username to \"" + name + "\""));
|
||||
player.sendMessage(
|
||||
Component.text("Successfully set your username to \"")
|
||||
.append(Component.text(name))
|
||||
.append(Component.text("\""))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
import com.destroystokyo.paper.profile.ProfileProperty;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
|
@ -40,7 +42,11 @@ public final class SkinDownloader {
|
|||
profile.setProperty(new ProfileProperty("textures", texture, signature));
|
||||
|
||||
if (shouldSendMessage) {
|
||||
player.sendMessage("Successfully set your skin to " + name + "'s");
|
||||
player.sendMessage(
|
||||
Component.text("Successfully set your skin to ")
|
||||
.append(Component.text(name))
|
||||
.append(Component.text("'s"))
|
||||
);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
try {
|
||||
|
@ -50,7 +56,8 @@ public final class SkinDownloader {
|
|||
}
|
||||
|
||||
if (shouldSendMessage) {
|
||||
player.sendMessage("A player with that username doesn't exist");
|
||||
player.sendMessage(Component
|
||||
.text("A player with that username doesn't exist"));
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue