-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+Added Config Options +Added Reset Command +Incremented Version
- Loading branch information
1 parent
4cb97bc
commit de7ba2c
Showing
7 changed files
with
176 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-Implement AppleSkin GUI mechanics to our overlay | ||
-On ALT_HOLD it should display saturation | ||
-When food item is in MAINHAND equipment slot, show percentage stat for food/saturation once item has been consumed (blinky effect) |
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
64 changes: 64 additions & 0 deletions
64
src/main/java/com/github/clevernucleus/playerex/init/ResetCommand.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,64 @@ | ||
package com.github.clevernucleus.playerex.init; | ||
|
||
import com.github.clevernucleus.playerex.api.ExAPI; | ||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
|
||
import net.minecraft.command.CommandSource; | ||
import net.minecraft.command.Commands; | ||
import net.minecraft.command.ISuggestionProvider; | ||
import net.minecraft.command.arguments.EntityArgument; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.server.management.PlayerList; | ||
import net.minecraft.util.text.StringTextComponent; | ||
import net.minecraft.util.text.TextFormatting; | ||
|
||
public class ResetCommand { | ||
|
||
/** Error procedure. */ | ||
private static boolean error(final CommandContext<CommandSource> par0, final PlayerEntity par1) { | ||
if(par1.world.isRemote) return true; | ||
|
||
PlayerList var0 = par0.getSource().getServer().getPlayerList(); | ||
|
||
if(!var0.getPlayers().contains(par1)) { | ||
par0.getSource().sendFeedback(new StringTextComponent(TextFormatting.RED + par1.getDisplayName().toString() + TextFormatting.GRAY + " does not exist!"), true); | ||
|
||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** A partially formed entitled command. */ | ||
private static int run(CommandContext<CommandSource> par0) throws CommandSyntaxException { | ||
par0.getSource().sendFeedback(new StringTextComponent(TextFormatting.RED + "/playerex player reset"), true); | ||
|
||
return 1; | ||
} | ||
|
||
private static int reset(CommandContext<CommandSource> par0, PlayerEntity par1) throws CommandSyntaxException { | ||
if(error(par0, par1)) return 1; | ||
|
||
EventHandler.reset(par1, true); | ||
EventHandler.update(par1); | ||
EventHandler.sync(par1); | ||
|
||
return 1; | ||
} | ||
|
||
/** | ||
* Register the command(s) to the game. | ||
* @param par0 | ||
*/ | ||
public static void register(CommandDispatcher<CommandSource> par0) { | ||
par0.register(Commands.literal(ExAPI.MODID) | ||
.requires(var -> var.hasPermissionLevel(2)) | ||
.executes(ResetCommand::run).then(Commands.argument("player", EntityArgument.player()).suggests((var0, var1) -> { | ||
PlayerList var2 = var0.getSource().getServer().getPlayerList(); | ||
|
||
return ISuggestionProvider.suggest(var2.getPlayers().stream().map(var3 -> var3.getGameProfile().getName()), var1); | ||
}).then(Commands.literal("reset").executes(var -> reset(var, EntityArgument.getPlayer(var, "player")))))); | ||
} | ||
} |
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