7 Commits
Author SHA1 Message Date
BlitzOffline 0555909799 Merge pull request #63 from Frcsty/3.0.0
3.0.0
2021-10-02 16:39:34 +03:00
Frcsty d40e1e2bdb Setting up v3 expansion 2021-10-02 11:47:38 +02:00
iGabyTM fae37a45aa add Matt's VersionHelper util 2021-10-02 11:45:35 +02:00
PiggyPiglet 2188684fbc push for frosty idek what changes i've made 2020-10-03 14:58:56 +08:00
PiggyPiglet 8f31c584b6 - moved util classes around
- removed protocol ids
- migrated scanner api to rules based system
- only bind main instance on non-sponge platforms
- expansions can use the file manager now
2020-09-13 21:40:55 +08:00
PiggyPiglet 89ece3e5d1 made it compile & changed ecloud to mock ver 2020-09-06 21:19:15 +08:00
PiggyPiglet b26086878f skeleton player expansion 2020-09-05 16:10:19 +08:00
5 changed files with 52 additions and 422 deletions

No files matched your search

+1 -173
View File
@@ -1,174 +1,2 @@
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
/.idea/
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Ruby plugin and RubyMine
/.rakeTasks
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
*.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### VS Code ###
.vscode/
### Gradle ###
.gradle/
gradle-app.setting
!gradle/wrapper/gradle-wrapper.jar
!gradle/wrapper/gradle-wrapper.properties
### OS/Logs ###
*.log
hs_err_pid*
Thumbs.db
Desktop.ini
.DS_Store
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
nbactions.xml
### Piggy's Debugging Shit ###
server/
gradlew.bat
gradlew
gradle/wrapper/gradle-wrapper.jar
libs/HytaleServer.jar
libs/papiHytale.jar
gradle/wrapper/gradle-wrapper.properties
out/
+2 -45
View File
@@ -1,46 +1,3 @@
plugins {
id 'java'
}
group = 'at.helpch.papi.expansion.player'
version = '1.0.5'
description = 'PlaceholderAPI expansion for Hytale player placeholders'
repositories {
mavenCentral()
mavenLocal()
maven {
url = uri("https://repo.codemc.io/repository/hytale/")
}
maven {
url = uri("https://repo.helpch.at/releases")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
dependencies {
compileOnly("com.hypixel.hytale:Server:2026.01.17-4b0f30090")
compileOnly("at.helpch:placeholderapi-hytale:1.0.0")
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.named('jar') {
archiveBaseName.set('PAPI-Expansion-Player')
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version
)
}
}
compileOnly project(":common")
}
-1
View File
@@ -1 +0,0 @@
rootProject.name = 'hyplayer-expansion'
@@ -1,203 +0,0 @@
package at.helpch.papi.expansion.player;
import at.helpch.placeholderapi.PlaceholderAPIPlugin;
import at.helpch.placeholderapi.expansion.PlaceholderExpansion;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap;
import com.hypixel.hytale.server.core.modules.entitystats.asset.DefaultEntityStatTypes;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.universe.world.worldgen.provider.IWorldGenProvider;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public final class PlayerExpansion extends PlaceholderExpansion {
public String getIdentifier() {
return "Player";
}
public String getAuthor() {
return "HelpChat";
}
public String getVersion() {
return "1.0.5";
}
public String onPlaceholderRequest(PlayerRef player, String identifier) {
if (player == null)
return "";
switch (identifier) {
case "uuid":
return player.getUuid().toString();
case "username":
return player.getUsername();
case "language":
return player.getLanguage();
case "world_uuid":
return player.getWorldUuid().toString();
case "x":
return String.valueOf(player.getTransform().getPosition().getX());
case "y":
return String.valueOf(player.getTransform().getPosition().getY());
case "z":
return String.valueOf(player.getTransform().getPosition().getZ());
case "yaw":
return String.valueOf(player.getHeadRotation().getYaw());
case "pitch":
return String.valueOf(player.getHeadRotation().getPitch());
}
Ref<EntityStore> ref = player.getReference();
if (ref == null || !ref.isValid())
return null;
Store<EntityStore> store = ref.getStore();
Player p = (Player) store.getComponent(ref, Player.getComponentType());
EntityStatMap stats = (EntityStatMap) store.getComponent(ref, EntityStatMap.getComponentType());
if (p == null)
return null;
switch (identifier) {
case "has_played_before":
return bool(!p.isFirstSpawn());
case "name":
return p.getDisplayName();
case "gamemode":
return p.getGameMode().name();
case "world":
return p.getWorld().getName();
case "world_displayname":
String displayName = p.getWorld().getWorldConfig().getDisplayName();
if (displayName == null) {
return p.getWorld().getName();
}
return displayName;
case "world_worldgen_type":
return worldGenType(p.getWorld().getWorldConfig().getWorldGenProvider());
case "world_worldgen_name":
return worldGenName(p.getWorld().getWorldConfig().getWorldGenProvider());
case "biome":
return p.getWorldMapTracker().getCurrentBiomeName();
case "item_in_hand":
return String.valueOf(p.getInventory().getActiveHotbarItem().getItemId());
case "item_in_hand_quantity":
return String.valueOf(p.getInventory().getActiveHotbarItem().getQuantity());
case "item_in_hand_durability":
return String.valueOf(p.getInventory().getActiveHotbarItem().getDurability());
case "item_in_hand_broken":
return bool(p.getInventory().getActiveHotbarItem().isBroken());
case "item_in_hand_unbreakable":
return bool(p.getInventory().getActiveHotbarItem().isUnbreakable());
case "current_fall_distance":
return String.valueOf(p.getCurrentFallDistance());
case "view_radius":
return String.valueOf(p.getViewRadius());
case "client_view_radius":
return String.valueOf(p.getClientViewRadius());
case "since_last_spawn_nanos":
return String.valueOf(p.getSinceLastSpawnNanos());
case "mount_entity_id":
return String.valueOf(p.getMountEntityId());
case "is_collidable":
return bool(p.isCollidable());
case "health":
return String.valueOf(stats.get(DefaultEntityStatTypes.getHealth()).get());
case "health_max":
return String.valueOf(stats.get(DefaultEntityStatTypes.getHealth()).getMax());
case "health_min":
return String.valueOf(stats.get(DefaultEntityStatTypes.getHealth()).getMin());
case "ammo":
return String.valueOf(stats.get(DefaultEntityStatTypes.getAmmo()).get());
case "ammo_max":
return String.valueOf(stats.get(DefaultEntityStatTypes.getAmmo()).getMax());
case "ammo_min":
return String.valueOf(stats.get(DefaultEntityStatTypes.getAmmo()).getMin());
case "stamina":
return String.valueOf(stats.get(DefaultEntityStatTypes.getStamina()).get());
case "stamina_max":
return String.valueOf(stats.get(DefaultEntityStatTypes.getStamina()).getMax());
case "stamina_min":
return String.valueOf(stats.get(DefaultEntityStatTypes.getStamina()).getMin());
case "mana":
return String.valueOf(stats.get(DefaultEntityStatTypes.getMana()).get());
case "mana_max":
return String.valueOf(stats.get(DefaultEntityStatTypes.getMana()).getMax());
case "mana_min":
return String.valueOf(stats.get(DefaultEntityStatTypes.getMana()).getMin());
case "oxygen":
return String.valueOf(stats.get(DefaultEntityStatTypes.getOxygen()).get());
case "oxygen_max":
return String.valueOf(stats.get(DefaultEntityStatTypes.getOxygen()).getMax());
case "oxygen_min":
return String.valueOf(stats.get(DefaultEntityStatTypes.getOxygen()).getMin());
case "signature_energy":
return String.valueOf(stats.get(DefaultEntityStatTypes.getSignatureEnergy()).get());
case "signature_energy_max":
return String.valueOf(stats.get(DefaultEntityStatTypes.getSignatureEnergy()).getMax());
case "signature_energy_min":
return String.valueOf(stats.get(DefaultEntityStatTypes.getSignatureEnergy()).getMin());
}
if (identifier.startsWith("has_permission_")) {
if ((identifier.split("has_permission_")).length > 1) {
String perm = identifier.split("has_permission_")[1];
return bool(p.hasPermission(perm));
}
return bool(false);
}
return null;
}
public String bool(boolean b) {
return b ? PlaceholderAPIPlugin.instance().configManager().config().booleanValue().trueValue()
: PlaceholderAPIPlugin.instance().configManager().config().booleanValue().falseValue();
}
private String worldGenType(IWorldGenProvider provider) {
if (provider == null)
return null;
try {
Field idField = provider.getClass().getField("ID");
Object id = idField.get(null);
if (id instanceof String)
return (String) id;
} catch (Exception ignored) {
}
String simpleName = provider.getClass().getSimpleName();
if (simpleName.endsWith("WorldGenProvider"))
return simpleName.substring(0, simpleName.length() - "WorldGenProvider".length());
return simpleName;
}
private String worldGenName(IWorldGenProvider provider) {
if (provider == null)
return null;
try {
Method getName = provider.getClass().getMethod("getName");
Object value = getName.invoke(provider);
if (value instanceof String)
return (String) value;
} catch (Exception ignored) {
}
try {
Field nameField = provider.getClass().getDeclaredField("name");
nameField.setAccessible(true);
Object value = nameField.get(provider);
if (value instanceof String)
return (String) value;
} catch (Exception ignored) {
}
return null;
}
}
@@ -0,0 +1,49 @@
package at.helpch.placeholderapi.expansion.player;
import at.helpch.placeholderapi.api.expansion.Expansion;
import at.helpch.placeholderapi.api.expansion.ExpansionDescription;
import at.helpch.placeholderapi.api.expansion.Platform;
import at.helpch.placeholderapi.api.expansion.placeholder.Placeholder;
import at.helpch.placeholderapi.api.expansion.placeholder.PlaceholderContext;
import at.helpch.placeholderapi.api.player.Player;
import at.helpch.placeholderapi.api.player.keyable.key.PlayerKeys;
import at.helpch.placeholderapi.api.server.Server;
import at.helpch.placeholderapi.expansion.time.TimeFormatter;
import at.helpch.placeholderapi.expansion.time.file.Config;
import com.google.inject.Inject;
import org.jetbrains.annotations.NotNull;
import java.sql.Time;
import java.util.function.Function;
@ExpansionDescription(
name = "Player",
version = "2.0.0",
identifier = "player",
authors = "HelpChat",
platforms = {Platform.BUKKIT, Platform.SPONGE, Platform.NUKKIT}
)
public final class PlayerExpansion extends Expansion {
private final TimeFormatter timeFormatter;
private final Config config;
@Inject
public PlayerExpansion(@NotNull final Config config) {
this.config = config;
// TODO: instantiate a single TimeFormatted through out the project, with a main config
this.timeFormatter = new TimeFormatter(config);
}
@Override
public void enable() {
}
@Placeholder("name")
private String name(final PlaceholderContext context) {
return context.getPlayer().get(PlayerKeys.NAME).orElse("");
}
}