-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
188 additions
and
30 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020-2021 Camotoy | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
61 changes: 61 additions & 0 deletions
61
src/main/java/com/github/camotoy/floodgate_skript/expressions/GetBedrockLocale.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,61 @@ | ||
package com.github.camotoy.floodgate_skript.expressions; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.ExpressionType; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.skript.lang.util.SimpleExpression; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.geysermc.floodgate.FloodgateAPI; | ||
import org.geysermc.floodgate.FloodgatePlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Name("get Bedrock locale") | ||
@Description("Returns the Bedrock language of the client") | ||
public class GetBedrockLocale extends SimpleExpression<String> { | ||
|
||
static { | ||
Skript.registerExpression(GetBedrockLocale.class, String.class, ExpressionType.COMBINED, | ||
"[the] [bedrock] (locale|language) of [the] [floodgate] %player%"); | ||
} | ||
|
||
private Expression<Player> player; | ||
|
||
@Override | ||
protected String[] get(@NotNull Event e) { | ||
Player bukkitPlayer = player.getSingle(e); | ||
if (bukkitPlayer != null) { | ||
FloodgatePlayer floodgatePlayer = FloodgateAPI.getPlayer(bukkitPlayer); | ||
if (floodgatePlayer != null) { | ||
return new String[] {floodgatePlayer.getLanguageCode()}; | ||
} | ||
} | ||
return new String[] {"Java"}; | ||
} | ||
|
||
@Override | ||
public boolean isSingle() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public @NotNull Class<? extends String> getReturnType() { | ||
return String.class; | ||
} | ||
|
||
@Override | ||
public @NotNull String toString(@Nullable Event e, boolean debug) { | ||
return "Get Floodgate player's language: " + player.toString(e, debug); | ||
} | ||
|
||
@Override | ||
public boolean init(Expression<?> @NotNull [] exprs, int matchedPattern, @NotNull Kleenean isDelayed, SkriptParser.@NotNull ParseResult parseResult) { | ||
player = (Expression<Player>) exprs[0]; | ||
return true; | ||
} | ||
} |
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
61 changes: 61 additions & 0 deletions
61
src/main/java/com/github/camotoy/floodgate_skript/expressions/GetBedrockVersion.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,61 @@ | ||
package com.github.camotoy.floodgate_skript.expressions; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.ExpressionType; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.skript.lang.util.SimpleExpression; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.geysermc.floodgate.FloodgateAPI; | ||
import org.geysermc.floodgate.FloodgatePlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Name("get Bedrock version") | ||
@Description("Returns the Bedrock version that the client is playing on") | ||
public class GetBedrockVersion extends SimpleExpression<String> { | ||
|
||
static { | ||
Skript.registerExpression(GetBedrockVersion.class, String.class, ExpressionType.COMBINED, | ||
"[the] [bedrock] version of [the] [floodgate] %player%"); | ||
} | ||
|
||
private Expression<Player> player; | ||
|
||
@Override | ||
protected String[] get(@NotNull Event e) { | ||
Player bukkitPlayer = player.getSingle(e); | ||
if (bukkitPlayer != null) { | ||
FloodgatePlayer floodgatePlayer = FloodgateAPI.getPlayer(bukkitPlayer); | ||
if (floodgatePlayer != null) { | ||
return new String[] {floodgatePlayer.getVersion()}; | ||
} | ||
} | ||
return new String[] {"Java"}; | ||
} | ||
|
||
@Override | ||
public boolean isSingle() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public @NotNull Class<? extends String> getReturnType() { | ||
return String.class; | ||
} | ||
|
||
@Override | ||
public @NotNull String toString(@Nullable Event e, boolean debug) { | ||
return "Get Floodgate player's Bedrock version: " + player.toString(e, debug); | ||
} | ||
|
||
@Override | ||
public boolean init(Expression<?> @NotNull [] exprs, int matchedPattern, @NotNull Kleenean isDelayed, SkriptParser.@NotNull ParseResult parseResult) { | ||
player = (Expression<Player>) exprs[0]; | ||
return true; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Floodgate-Skript | ||
version: ${project.version} | ||
main: org.geysermc.floodgateskript.FloodgateSkript | ||
main: com.github.camotoy.floodgate_skript.FloodgateSkript | ||
api-version: 1.15 | ||
authors: [GeyserMC] | ||
authors: [Camotoy] | ||
depend: [floodgate-bukkit, Skript] | ||
softdepend: [Geyser-Bukkit] | ||
softdepend: [Geyser-Spigot] |