Formatting changes

This commit is contained in:
KingRainbow44
2022-04-28 22:21:30 -04:00
parent e666dede7e
commit d701613831
11 changed files with 36 additions and 60 deletions

View File

@@ -8,13 +8,14 @@ import java.util.List;
@Command(label = "coop", usage = "coop",
description = "Forces someone to join the world of others", permission = "server.coop")
public class CoopCommand implements CommandHandler {
public final class CoopCommand implements CommandHandler {
@Override
public void execute(Player sender, List<String> args) {
if (args.size() < 2) {
CommandHandler.sendMessage(sender, "Usage: coop <playerId> <target playerId>");
return;
}
try {
int tid = Integer.parseInt(args.get(0));
int hostId = Integer.parseInt(args.get(1));

View File

@@ -15,7 +15,7 @@ import java.util.*;
@Command(label = "giveall", usage = "giveall [player] [amount]",
description = "Gives all items", aliases = {"givea"}, permission = "player.giveall", threading = true)
public class GiveAllCommand implements CommandHandler {
public final class GiveAllCommand implements CommandHandler {
@Override
public void execute(Player sender, List<String> args) {
@@ -142,16 +142,11 @@ public class GiveAllCommand implements CommandHandler {
}
}
if (testItemsList.contains(itemId)) {
return true;
}
return false;
return testItemsList.contains(itemId);
}
static class Range {
private int min;
private int max;
private final int min, max;
public Range(int min, int max) {
if(min > max){
@@ -159,6 +154,7 @@ public class GiveAllCommand implements CommandHandler {
max ^= min;
min ^= max;
}
this.min = min;
this.max = max;
}

View File

@@ -6,24 +6,20 @@ import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.packet.send.PacketMailChangeNotify;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@Command(label = "sendmail", usage = "sendmail <userId|all|help> [templateId]",
description = "Sends mail to the specified user. The usage of this command changes based on it's composition state.", permission = "server.sendmail")
public class SendMailCommand implements CommandHandler {
public final class SendMailCommand implements CommandHandler {
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
// However, due to the current nature of the command system, I don't think this is possible without rewriting
// the command system (again). For now this will do
// Key = User that is constructing the mail.
private static HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<Integer, MailBuilder>();
private static final HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<Integer, MailBuilder>();
// Yes this is awful and I hate it.
@Override
@@ -48,7 +44,6 @@ public class SendMailCommand implements CommandHandler {
default -> {
if (DatabaseHelper.getPlayerById(Integer.parseInt(args.get(0))) != null) {
mailBuilder = new MailBuilder(Integer.parseInt(args.get(0)), new Mail());
break;
} else {
CommandHandler.sendMessage(sender, "The user with an id of '" + args.get(0) + "' does not exist");
return;
@@ -73,7 +68,7 @@ public class SendMailCommand implements CommandHandler {
}
case "finish" -> {
if (mailBuilder.constructionStage == 3) {
if (mailBuilder.sendToAll == false) {
if (!mailBuilder.sendToAll) {
Grasscutter.getGameServer().getPlayerByUid(mailBuilder.recipient, true).sendMail(mailBuilder.mail);
CommandHandler.sendMessage(sender, "Message sent to user " + mailBuilder.recipient + "!");
} else {

View File

@@ -9,23 +9,25 @@ import java.util.List;
@Command(label = "tpall", usage = "tpall",
description = "Teleports all players in your world to your position", permission = "player.tpall")
public class TpallCommand implements CommandHandler {
public final class TeleportAllCommand implements CommandHandler {
@Override
public void execute(Player sender, List<String> args) {
if (sender == null) {
CommandHandler.sendMessage(null, "Run this command in-game.");
return;
}
if (!sender.getWorld().isMultiplayer()) {
CommandHandler.sendMessage(sender, "You only can use this command in MP mode.");
return;
}
for (Player gp : sender.getWorld().getPlayers()) {
if (gp.equals(sender))
for (Player player : sender.getWorld().getPlayers()) {
if (player.equals(sender))
continue;
Position pos = sender.getPos();
gp.getWorld().transferPlayerToScene(gp, sender.getSceneId(), pos);
player.getWorld().transferPlayerToScene(player, sender.getSceneId(), pos);
}
}
}