pala M-faction-1b: /f kick + /f transfer
This commit is contained in:
@@ -606,6 +606,10 @@ avant M4 (TODO:crafts-machines).
|
|||||||
invite / join / leave / disband. Lecon : Inventory.items prive en 26.3 -> getItem(i).
|
invite / join / leave / disband. Lecon : Inventory.items prive en 26.3 -> getItem(i).
|
||||||
Grades/claims/elo : M-faction-2. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur.
|
Grades/claims/elo : M-faction-2. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur.
|
||||||
UNVERIFIED en jeu (2 joueurs).
|
UNVERIFIED en jeu (2 joueurs).
|
||||||
|
- M-faction-1b LIVRE 2026-10-19 ~04:15 : /f kick + /f transfer (trou bouche : le chef ne
|
||||||
|
pouvait pas partir). Lecon : compter les parentheses d'un chainage brigadier au python
|
||||||
|
(le patch fuzzy fusionne les lignes). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur.
|
||||||
|
UNVERIFIED en jeu.
|
||||||
- M-palaforge LIVRE 2026-10-19 ~03:55 : bloc + BE partagee (3e mode) + gate mineur 14 +
|
- M-palaforge LIVRE 2026-10-19 ~03:55 : bloc + BE partagee (3e mode) + gate mineur 14 +
|
||||||
table fonte wiki §3.2 (31 items, ratio floor usure) + fuels bois (+buche/planches/baton,
|
table fonte wiki §3.2 (31 items, ratio floor usure) + fuels bois (+buche/planches/baton,
|
||||||
lave exclue : seau non rendu) + craft (1 findium + 4 furnaces + 4 briques, positions
|
lave exclue : seau non rendu) + craft (1 findium + 4 furnaces + 4 briques, positions
|
||||||
|
|||||||
@@ -172,7 +172,15 @@ public final class PalaCommands {
|
|||||||
.then(Commands.literal("leave")
|
.then(Commands.literal("leave")
|
||||||
.executes(command -> fLeave(command.getSource())))
|
.executes(command -> fLeave(command.getSource())))
|
||||||
.then(Commands.literal("disband")
|
.then(Commands.literal("disband")
|
||||||
.executes(command -> fDisband(command.getSource()))));
|
.executes(command -> fDisband(command.getSource())))
|
||||||
|
.then(Commands.literal("kick")
|
||||||
|
.then(Commands.argument("cible", EntityArgument.player())
|
||||||
|
.executes(command -> fKick(command.getSource(),
|
||||||
|
EntityArgument.getPlayer(command, "cible")))))
|
||||||
|
.then(Commands.literal("transfer")
|
||||||
|
.then(Commands.argument("cible", EntityArgument.player())
|
||||||
|
.executes(command -> fTransfer(command.getSource(),
|
||||||
|
EntityArgument.getPlayer(command, "cible"))))));
|
||||||
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
||||||
.register(PalaCommands::tickSpawnQueue);
|
.register(PalaCommands::tickSpawnQueue);
|
||||||
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
||||||
@@ -490,6 +498,62 @@ public final class PalaCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// M-faction-1b : kick (chef, pas sur soi-meme) + transfer (passation chef, debloque /f leave).
|
||||||
|
private static int fKick(CommandSourceStack source, ServerPlayer cible) {
|
||||||
|
try {
|
||||||
|
ServerPlayer player = source.getPlayerOrException();
|
||||||
|
fr.surviepote.pala.core.PalaFactions.Faction faction =
|
||||||
|
fr.surviepote.pala.core.PalaFactions.get()
|
||||||
|
.byMember(player.getUUID().toString());
|
||||||
|
if (faction == null || !faction.owner.equals(player.getUUID().toString())) {
|
||||||
|
source.sendFailure(Component.literal("§cSeul le chef peut exclure."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (cible.getUUID().equals(player.getUUID())) {
|
||||||
|
source.sendFailure(Component.literal("§cVous ne pouvez pas vous exclure."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!faction.members.remove(cible.getUUID().toString())) {
|
||||||
|
source.sendFailure(Component.literal("§cCe joueur n'est pas dans votre faction."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fr.surviepote.pala.core.PalaFactions.get().markDirty();
|
||||||
|
cible.sendSystemMessage(Component.literal(
|
||||||
|
"§6[Faction] §7Vous avez ete exclu de " + faction.name + "."));
|
||||||
|
source.sendSuccess(() -> Component.literal("§6[Faction] §7"
|
||||||
|
+ cible.getScoreboardName() + " exclu de " + faction.name + "."), false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int fTransfer(CommandSourceStack source, ServerPlayer cible) {
|
||||||
|
try {
|
||||||
|
ServerPlayer player = source.getPlayerOrException();
|
||||||
|
fr.surviepote.pala.core.PalaFactions.Faction faction =
|
||||||
|
fr.surviepote.pala.core.PalaFactions.get()
|
||||||
|
.byMember(player.getUUID().toString());
|
||||||
|
if (faction == null || !faction.owner.equals(player.getUUID().toString())) {
|
||||||
|
source.sendFailure(Component.literal("§cSeul le chef peut transferer."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!faction.members.contains(cible.getUUID().toString())) {
|
||||||
|
source.sendFailure(Component.literal("§cCe joueur n'est pas dans votre faction."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
faction.owner = cible.getUUID().toString();
|
||||||
|
fr.surviepote.pala.core.PalaFactions.get().markDirty();
|
||||||
|
source.getServer().getPlayerList().broadcastSystemMessage(
|
||||||
|
Component.literal("§6[Faction] §e" + cible.getScoreboardName()
|
||||||
|
+ " §7est le nouveau chef de §e" + faction.name + " §7!"),
|
||||||
|
false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static int fDisband(CommandSourceStack source) {
|
private static int fDisband(CommandSourceStack source) {
|
||||||
try {
|
try {
|
||||||
ServerPlayer player = source.getPlayerOrException();
|
ServerPlayer player = source.getPlayerOrException();
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user