Search in sources :

Example 31 with Message

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

the class DisbandCommand method run.

@Override
public int run(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
    ServerCommandSource source = context.getSource();
    ServerPlayerEntity player = source.getPlayer();
    Member member = Member.get(player.getUuid());
    Faction faction = member.getFaction();
    new Message(player.getName().asString() + " disbanded the faction").send(faction);
    faction.remove();
    PlayerManager manager = source.getServer().getPlayerManager();
    for (ServerPlayerEntity p : manager.getPlayerList()) {
        manager.sendCommandTree(p);
    }
    return 1;
}
Also used : Message(io.icker.factions.util.Message) PlayerManager(net.minecraft.server.PlayerManager) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) Member(io.icker.factions.database.Member) ServerCommandSource(net.minecraft.server.command.ServerCommandSource) Faction(io.icker.factions.database.Faction)

Example 32 with Message

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

the class ChatEvents method faction.

public static void faction(ServerPlayerEntity sender, Faction faction, String message) {
    FactionsMod.LOGGER.info("[" + faction.name + " " + sender.getName().asString() + " -> " + faction.name + "] " + message);
    new Message(sender.getName().asString()).add(new Message(" F").format(Formatting.BOLD, faction.color)).filler("»").add(new Message(message).format(Formatting.GRAY)).sendToFactionChat(faction);
}
Also used : Message(io.icker.factions.util.Message)

Example 33 with Message

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

the class ChatEvents method memberGlobal.

public static void memberGlobal(ServerPlayerEntity sender, Faction faction, String message) {
    FactionsMod.LOGGER.info("[" + faction.name + " " + sender.getName().asString() + " -> All] " + message);
    String rank = "";
    for (Member member : faction.getMembers()) if (member.uuid.equals(sender.getUuid()))
        rank = member.getRank().name().toLowerCase().replace("_", " ");
    new Message("").add(new Message(faction.name).format(Formatting.BOLD, faction.color)).add(" " + rank).add(" " + sender.getName().asString()).filler("»").add(new Message(message).format(Formatting.GRAY)).sendToGlobalChat();
}
Also used : Message(io.icker.factions.util.Message) Member(io.icker.factions.database.Member)

Example 34 with Message

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

the class ChatEvents method global.

public static void global(ServerPlayerEntity sender, String message) {
    FactionsMod.LOGGER.info("[" + sender.getName().asString() + " -> All] " + message);
    new Message(sender.getName().asString()).filler("»").add(new Message(message).format(Formatting.GRAY)).sendToGlobalChat();
}
Also used : Message(io.icker.factions.util.Message)

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