Skip to content

Commit

Permalink
Deprecate respawn()
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Jan 28, 2024
1 parent 3d76fbb commit 48dc975
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
Gives access to API available in Spigot but not Bukkit. As CommandHelper now depends on Spigot,
these functions and events are subject to be moved into CommandHelper at some point.

## Compatibility
## Recommended Builds

* [**CHSpigot 2.0.7 for Spigot 1.16.5 - 1.20.4**](https://github.com/PseudoKnight/CHSpigot/releases/tag/v2.0.7) (CommandHelper 3.3.5 #332 or later) [Documentation](https://github.com/PseudoKnight/CHSpigot/blob/master/README.md)
* [**CHSpigot 2.0.6 for Spigot 1.16.5 - 1.20.3**](https://github.com/PseudoKnight/CHSpigot/releases/tag/v2.0.6) (CommandHelper 3.3.5 #332 or later) [Documentation](https://github.com/PseudoKnight/CHSpigot/blob/master/README.md)
* [**CHSpigot 2.0.4 for Spigot 1.13.2 - 1.18.2**](https://letsbuild.net/jenkins/job/CHSpigot/29/artifact/target/chspigot-2.0.4.jar) (CommandHelper 3.3.4 #3766 - 3.3.5 #255) [Documentation](https://github.com/PseudoKnight/CHSpigot/blob/v2.0.4/README.md)
* [**CHSpigot 2.0.8 for Spigot 1.16.5 - 1.20.4**](https://github.com/PseudoKnight/CHSpigot/releases/tag/v2.0.8) (CommandHelper 3.3.5 #332 or later) [Documentation](https://github.com/PseudoKnight/CHSpigot/blob/master/README.md)
* [**CHSpigot 2.0.4 for Spigot 1.13.2 - 1.16.5**](https://letsbuild.net/jenkins/job/CHSpigot/29/artifact/target/chspigot-2.0.4.jar) (CommandHelper 3.3.4) [Documentation](https://github.com/PseudoKnight/CHSpigot/blob/v2.0.4/README.md)
* [**CHSpigot 1.6.0a for Spigot 1.12.2**](https://github.com/PseudoKnight/CHSpigot/releases/tag/v1.6.0a) (CommandHelper 3.3.2) [Documentation](https://github.com/PseudoKnight/CHSpigot/blob/v1.6.0a/README.md)

## Function Documentation

### Player API

**respawn([player])**

If the player is dead, it will respawn them.

**get_hidden_players([player])**

Returns an array of players who cannot see the player.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.pseudoknight</groupId>
<artifactId>chspigot</artifactId>
<version>2.0.7</version>
<version>2.0.8</version>
<name>CHSpigot</name>
<description>Gives access to methods available in Spigot but not Bukkit</description>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/pseudoknight/chspigot/Extension.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@MSExtension("CHSpigot")
public class Extension extends AbstractExtension {

private final SimpleVersion VERSION = new SimpleVersion(2,0,7);
private final SimpleVersion VERSION = new SimpleVersion(2,0,8);

@Override
public Version getVersion() {
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/me/pseudoknight/chspigot/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static String docs() {
}

@api
public static class respawn extends AbstractFunction {
public static class respawn extends AbstractFunction implements Optimizable {

public Class<? extends CREThrowable>[] thrown() {
return new Class[]{CREPlayerOfflineException.class};
Expand Down Expand Up @@ -68,13 +68,26 @@ public Integer[] numArgs() {
}

public String docs() {
return "void {[player]} Respawns the player immediately.";
return "void {[player]} Respawns the player immediately. Deprecated for pforce_respawn() in CommandHelper.";
}

public Version since() {
return MSVersion.V3_3_1;
}

@Override
public Set<OptimizationOption> optimizationOptions() {
return EnumSet.of(OptimizationOption.OPTIMIZE_DYNAMIC);
}

@Override
public ParseTree optimizeDynamic(Target t, Environment env, Set<Class<? extends Environment.EnvironmentImpl>> envs,
List<ParseTree> children, FileOptions fileOptions)
throws ConfigCompileException, ConfigRuntimeException {
env.getEnv(CompilerEnvironment.class).addCompilerWarning(fileOptions, new CompilerWarning(
"respawn() is deprecated for pforce_respawn() in CommandHelper.", t, null));
return null;
}
}

@api
Expand Down Expand Up @@ -111,7 +124,7 @@ public Integer[] numArgs() {
}

public String docs() {
return "string {[player]} Gets the player's locale language. Deprecated for plocale().";
return "string {[player]} Gets the player's locale language. Deprecated for plocale() in CommandHelper.";
}

public Version since() {
Expand All @@ -128,7 +141,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, Set<Class<? extends
List<ParseTree> children, FileOptions fileOptions)
throws ConfigCompileException, ConfigRuntimeException {
env.getEnv(CompilerEnvironment.class).addCompilerWarning(fileOptions, new CompilerWarning(
"player_locale() is deprecated for plocale().", t, null));
"player_locale() is deprecated for plocale() in CommandHelper", t, null));
return null;
}
}
Expand Down

0 comments on commit 48dc975

Please sign in to comment.