Search in sources :

Example 26 with Message

use of io.icker.factions.util.Message in project factions by ickerio.

the class ModifyCommand method color.

public static int color(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
    Formatting color = ColorArgumentType.getColor(context, "color");
    ServerCommandSource source = context.getSource();
    ServerPlayerEntity player = source.getPlayer();
    Member.get(player.getUuid()).getFaction().setColor(color);
    new Message("Successfully updated faction color").send(player, false);
    return 1;
}
Also used : Message(io.icker.factions.util.Message) Formatting(net.minecraft.util.Formatting) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) ServerCommandSource(net.minecraft.server.command.ServerCommandSource)

Example 27 with Message

use of io.icker.factions.util.Message in project factions by ickerio.

the class AllyCommand method list.

public static int list(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
    ServerCommandSource source = context.getSource();
    ServerPlayerEntity player = source.getPlayer();
    Faction faction = Member.get(player.getUuid()).getFaction();
    ArrayList<Ally> invites = Ally.getAllyInvites(faction.name);
    for (Ally ally : invites) {
        new Message(ally.source + " has invited you").format(Formatting.YELLOW).hover("Click to accept them as an ally").click("/factions ally accept " + ally.source).send(player, false);
    }
    return 1;
}
Also used : Message(io.icker.factions.util.Message) Ally(io.icker.factions.database.Ally) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) ServerCommandSource(net.minecraft.server.command.ServerCommandSource) Faction(io.icker.factions.database.Faction)

Example 28 with Message

use of io.icker.factions.util.Message in project factions by ickerio.

the class AllyCommand method remove.

public static int remove(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
    ServerPlayerEntity target = EntityArgumentType.getPlayer(context, "player");
    ServerCommandSource source = context.getSource();
    ServerPlayerEntity player = source.getPlayer();
    Faction sourceFaction = Member.get(player.getUuid()).getFaction();
    Faction targetFaction = Member.get(target.getUuid()).getFaction();
    if (!Ally.checkIfAlly(sourceFaction.name, targetFaction.name)) {
        new Message(targetFaction.name + " is not allied").format(Formatting.RED).send(player, false);
    } else {
        Ally.remove(sourceFaction.name, targetFaction.name);
        new Message(target.getName().getString() + " is no longer allied").send(sourceFaction);
        new Message("You are no longer allies with " + sourceFaction.name).format(Formatting.YELLOW).send(target, false);
    }
    return 1;
}
Also used : Message(io.icker.factions.util.Message) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) ServerCommandSource(net.minecraft.server.command.ServerCommandSource) Faction(io.icker.factions.database.Faction)

Example 29 with Message

use of io.icker.factions.util.Message in project factions by ickerio.

the class BypassCommand method run.

@Override
public int run(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
    ServerCommandSource source = context.getSource();
    ServerPlayerEntity player = source.getPlayer();
    PlayerConfig config = PlayerConfig.get(player.getUuid());
    boolean bypass = !config.bypass;
    config.setBypass(bypass);
    new Message("Successfully toggled claim bypass").filler("ยท").add(new Message(bypass ? "ON" : "OFF").format(bypass ? Formatting.GREEN : Formatting.RED)).send(player, false);
    return 1;
}
Also used : Message(io.icker.factions.util.Message) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) ServerCommandSource(net.minecraft.server.command.ServerCommandSource) PlayerConfig(io.icker.factions.database.PlayerConfig)

Example 30 with Message

use of io.icker.factions.util.Message in project factions by ickerio.

the class CreateCommand method run.

@Override
public int run(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
    String name = StringArgumentType.getString(context, "name");
    ServerCommandSource source = context.getSource();
    ServerPlayerEntity player = source.getPlayer();
    if (Faction.get(name) != null) {
        new Message("Cannot create a faction as a one with that name already exists").fail().send(player, false);
        return 0;
    }
    Faction.add(name, "No description set", Formatting.WHITE.getName(), false, Config.BASE_POWER + Config.MEMBER_POWER).addMember(player.getUuid(), Member.Rank.OWNER);
    source.getServer().getPlayerManager().sendCommandTree(player);
    new Message("Successfully created faction").send(player, false);
    return 1;
}
Also used : Message(io.icker.factions.util.Message) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) ServerCommandSource(net.minecraft.server.command.ServerCommandSource)

Aggregations

Message (io.icker.factions.util.Message)34 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)29 ServerCommandSource (net.minecraft.server.command.ServerCommandSource)28 Faction (io.icker.factions.database.Faction)24 Member (io.icker.factions.database.Member)14 ServerWorld (net.minecraft.server.world.ServerWorld)5 Formatting (net.minecraft.util.Formatting)5 CommandContext (com.mojang.brigadier.context.CommandContext)4 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)4 Claim (io.icker.factions.database.Claim)4 Invite (io.icker.factions.database.Invite)4 ChunkPos (net.minecraft.util.math.ChunkPos)4 PlayerConfig (io.icker.factions.database.PlayerConfig)3 ArrayList (java.util.ArrayList)3 Collectors (java.util.stream.Collectors)3 GameProfile (com.mojang.authlib.GameProfile)2 Ally (io.icker.factions.database.Ally)2 Home (io.icker.factions.database.Home)2 UserCache (net.minecraft.util.UserCache)2 Util (net.minecraft.util.Util)2