This repository has been archived by the owner on Mar 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #648 from rettichlp/hotfix/1-9-2
hotfix/1-9-2
- Loading branch information
Showing
10 changed files
with
315 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/main/java/com/rettichlp/unicacityaddon/commands/DutyCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.rettichlp.unicacityaddon.commands; | ||
|
||
import com.rettichlp.unicacityaddon.base.abstraction.AbstractionLayer; | ||
import com.rettichlp.unicacityaddon.base.abstraction.UPlayer; | ||
import com.rettichlp.unicacityaddon.base.builder.TabCompletionBuilder; | ||
import com.rettichlp.unicacityaddon.base.manager.FactionManager; | ||
import com.rettichlp.unicacityaddon.base.registry.annotation.UCCommand; | ||
import com.rettichlp.unicacityaddon.base.text.ColorCode; | ||
import com.rettichlp.unicacityaddon.base.text.Message; | ||
import net.minecraft.command.ICommand; | ||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraftforge.client.IClientCommand; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* @author RettichLP | ||
*/ | ||
@UCCommand | ||
public class DutyCommand implements IClientCommand { | ||
|
||
@Override | ||
@Nonnull | ||
public String getName() { | ||
return "checkduty"; | ||
} | ||
|
||
@Override | ||
@Nonnull | ||
public String getUsage(@Nonnull ICommandSender sender) { | ||
return "/checkduty [Spieler]"; | ||
} | ||
|
||
@Override | ||
@Nonnull | ||
public List<String> getAliases() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public boolean checkPermission(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender) { | ||
return AbstractionLayer.getPlayer().isSuperUser(); | ||
} | ||
|
||
@Override | ||
public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) { | ||
UPlayer p = AbstractionLayer.getPlayer(); | ||
|
||
if (args.length == 0) { | ||
p.sendSyntaxMessage(getUsage(sender)); | ||
return; | ||
} | ||
|
||
boolean isDuty = FactionManager.checkPlayerDuty(args[0]); | ||
|
||
p.sendMessage(Message.getBuilder() | ||
.of("Der Spieler").color(ColorCode.GRAY).advance().space() | ||
.of(args[0]).color(ColorCode.AQUA).advance().space() | ||
.of("befindet sich für das UnicacityAddon").color(ColorCode.GRAY).advance().space() | ||
.of((isDuty ? "" : "nicht ") + "im Dienst").color(isDuty ? ColorCode.GREEN : ColorCode.RED).advance() | ||
.of(".").color(ColorCode.GRAY).advance() | ||
.createComponent()); | ||
} | ||
|
||
@Override | ||
@Nonnull | ||
public List<String> getTabCompletions(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args, @Nullable BlockPos targetPos) { | ||
return TabCompletionBuilder.getBuilder(args).build(); | ||
} | ||
|
||
@Override | ||
public boolean isUsernameIndex(@Nonnull String[] args, int index) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean allowUsageWithoutPrefix(ICommandSender sender, String message) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int compareTo(@Nonnull ICommand o) { | ||
return 0; | ||
} | ||
} |
Oops, something went wrong.