pesekjak / hippo Goto Github PK
View Code? Open in Web Editor NEWSkript addon for custom classes
License: MIT License
Skript addon for custom classes
License: MIT License
output
[Skript] No matching non-static field: PlayerWrap#dataFile
[Skript] No matching non-static field: PlayerWrap#data
I don't know what cause it
Code seem fine to me
main.sk
import:
my.skript.PlayerWrap
on right click:
set {_playerData} to new PlayerWrap(player)
send "Hello " and {_playerData}.getName() to player
playerData.sk
import:
java.lang.Integer
java.lang.String
org.bukkit.Location
preimport:
my.skript.data.PlayerData
public skript class my.skript.data.PlayerData:
public String name
public Integer lastOnline
public Location lastLocation
public Integer money
playerWrap.sk
import:
java.lang.Integer
java.lang.Object
java.lang.String
org.bukkit.Location
org.bukkit.entity.Player
my.skript.utils.Yaml
my.skript.data.PlayerData
preimport:
my.skript.PlayerWrap
public skript class my.skript.PlayerWrap:
private Player player
private String uuid
private Yaml dataFile
public PlayerData data
public PlayerWrap(Player player):
super[]()
set this.uuid to uuid of {_player}
set this.dataFile to new Yaml("player")
if this.dataFile.isNodeExist(this.uuid):
set this.data to this.dataFile.readObject(this.uuid)
else:
set this.data to new PlayerData()
set this.data.name to {_player}.getName()
set this.data.lastOnline to {_player}.getPlayerTime()
set this.data.lastLocation to {_player}.getLocation()
set this.data.money to 0
this.saveAll()
public void saveAll():
this.dataFile.saveObject(this.uuid, this.data)
yaml.sk
import:
java.lang.Integer
java.lang.String
java.lang.Object
preimport:
my.skript.utils.Yaml
public skript class my.skript.utils.Yaml:
private String yamlPath = "plugins/Skript/scripts/data/"
private String file
public Yaml(String name):
super[]()
set this.file to "%this.yamlPath%%{_name}%.yml"
if file this.file does not exist:
create file this.file
public Object readObject(String node):
set {_value} to yml value {_node} from file this.file
return {_value}
public void saveObject(String node, Object data):
set yml value {_node} from file this.file to {_data}
public boolean isNodeExist(String node):
if yaml {_node} in file this.file does not exist:
return false
return true
Skript 2.7 seems to broke this addon. Will there be any updates?
Hello! I found one problem that confuses me
Hippo class:
public skript class crew.nms.DummyPlayerConnection extends PlayerConnection:
public DummyPlayerConnection(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer):
super[MinecraftServer,NetworkManager,EntityPlayer]({_minecraftServer}, {_networkManager}, {_entityPlayer})
set {_playerConnection} to new DummyPlayerConnection({_minecraftServer},{_networkManager}, {_entityPlayer})
# throw null pointer exception:
# constructor DummyPlayerConnection#<init> called with (net.minecraft.server.dedicated.DedicatedServer@6d123710 (DedicatedServer),
# net.minecraft.network.NetworkManager@145883af (NetworkManager), EntityPlayer['test'/1, uuid='f34b1200-30ea-4198-ae93-08d58c182326',
# l='ServerLevel[.world]', x=0.50, y=68.00, z=0.50, cpos=[0, 0], tl=0, v=false](test at 0.5,68.0,0.5) (EntityPlayer)) threw a NullPointerException:
# Cannot invoke "net.minecraft.network.NetworkManager.a(net.minecraft.network.PacketListener)" because "connection" is null.
set {_playerConnection} to new PlayerConnection({_minecraftServer},{_networkManager}, {_entityPlayer})
# not throw
Upon loading this skript file, I got 2 errors (see additional context).
This snippet worked (without any error) with an older version of Skript, skript-reflect, Hippo (v1) and paper obviously (paper 1.19).
import:
com.plotsquared.core.player.PlotPlayer
com.plotsquared.core.plot.Plot
com.plotsquared.core.PlotAPI
com.plotsquared.core.PlotSquared
. . .
preimport:
hippo.classes.P2Listener
public skript class hippo.classes.P2Listener:
public P2Listener():
super[]()
set {PlotAPI} to new PlotAPI()
{PlotAPI}.registerListener(this)
@Subscribe
public void onPlayerEnterPlot(PlayerEnterPlotEvent event):
# Test code
set {_plot} to {_event}.getPlot()
broadcast "%{_plot}%"
on load:
if {PlotListener} is set:
PlotSquared.get().getEventDispatcher().unregisterListener({PlotListener})
set {PlotListener} to new P2Listener()
Load correctly my skript file.
hippo: 1.1
skript-reflect: 2.4-dev1
Skript: 2.7.1
Server Verion: git-Paper-261 (MC: 1.20.2)
Minecraft: 1.20.2
Java: 17.0.7 (OpenJDK 64-Bit Server VM 17.0.7+7-Debian-1deb11u1)
OS: Linux amd64 5.10.0-24-amd64
You can find here complete stack trace of the reload:
> sk reload CreatifMenu
[00:42:24 INFO]: Line 81: (CreatifMenu.sk)
[00:42:24 INFO]: Can't understand this structure: public skript class hippo.classes.P2Listener
[00:42:24 INFO]: Line: public skript class hippo.classes.P2Listener:
[00:42:24 INFO]:
[00:42:25 INFO]: Line 172: (CreatifMenu.sk)
[00:42:25 INFO]: Your code reached reference of not yet compiled class 'hippo.classes.P2Listener'. Make sure this pre-imported class got compiled without problems. (Expected problem: Class does not exist)
[00:42:25 INFO]: Line: set {PlotListener} to new P2Listener()
[00:42:25 INFO]:
[00:42:25 INFO]: [Skript] Encountered 1 error while reloading CreatifMenu.sk! (1361ms)
Not sure if this is a Skript issue or a Hippo issue. I found Github issues on Skript's repo regarding this, but none of it applies to this from what I can tell.
When running the following code, I get an error:
preimport:
Buildable
Tower
import:
org.bukkit.Location
public and abstract class Buildable:
public Location location
public Buildable(Location loc):
super[]()
set this.location to this.loc
public class Tower extends Buildable:
public Tower(Location loc):
super[Location](loc)
on load:
loop all players:
set {_t} to new Tower(loop-player's location)
This is my /sk info:
My code looks a little different from the wiki because it seems the wiki's syntax hasn't been updated to Hippo 1.1 (I haven't been able to use namespaces or wtv they're called, nor "argument" in a constructor, but I'm assuming that was intentional). Without the code in the on load
event, everything works fine, although that's probably because it isn't trying to do anything.
Trying to broadcast the class of {_t} doesn't send anything. I've tried using arg-1 (which gave an error) in the super call, and I've also tried using this.loc, although that gives a separate error about how I'm not allowed to use this
until after the super call.
Edit: Server version 1.19.4 Paper git-550. The line 55 in the error is also accurate, I just trimmed irrelevant (and unused) methods in each class for convenience.
Whenever I write a constructor with multiple arguments, it parses fine, but calling it with multiple arguments treats the constructor as if only the first was written.
preimport:
Blob
public class Blob:
private String name
private int age
public Blob(string name, int age):
super[]()
set this.name to {_name}
set this.age to {_age}
on load:
set {_n} to new Blob("sample name", 1)
Result: No matching static constructor: Blob. called with (sample name (String), 1 (Long))
This occurs in the on load: event, or anywhere else it might be called.
Passing just "sample name" into the constructor (without the second arg) returns no error and {_n} is set to a Blob instance.
This happens with all of the classes I've tested it with. A workaround I'm leaning towards using is just an abundance of setter methods, but this makes things rather inconvenient.
If I define 2 constructors, one with string name and the other with string name, int age, it'll give me an error on the second constructor, saying it has the same arguments as the first.
I've been trying to troubleshoot for 4 days. I think the issue may be with the regex on the constructor's section definition.
I've also asked someone else, and they said everything worked perfectly fine (although, they were a bit preocupied with farming, so I'm not sure if they were paying the fullest attention as to what hippo version they use).
Paper 1.19.4 git-550, Java 17
Skript 2.8.0, skript-reflect 2.4, Hippo 1.1, skript-yaml 1.5, SkBee 3.1.0, Vault v1.7.3-b131
Edit: Also occurs on Skript 2.8.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.