#help-development
1 messages · Page 1872 of 1
i dont know anything about nms
unix socket is far more efficient then TCP connection pooling if both server and DB are on the same system and even more secure
Turns out it gives you a proxy that implements the Connection interface.
You are meant to close said proxy after use
Which doesn’t actually close the jdbc connection
sounds more like it lol
maybe I should create a new SQL lib for people that makes use of native unix sockets in java 🙂
things from the net.minecraft.server package
u trying to make npc's?
Yesss
i saw this to add entities to the world
https://github.com/JordanOsterberg/NPCAPI/blob/33a71031a46891d3c895a62337cd7d8ed4944877/src/main/java/dev/jcsoftware/npcs/versioned/NPC_v1_16_R3.java#L52
private void createObara(BlockPlaceEvent e) {
double x = e.getBlock().getX();
double y = e.getBlock().getY();
double z = e.getBlock().getZ();
float f1 = e.getBlock().getLocation().getPitch();
float f2 = e.getBlock().getLocation().getYaw();
Location loc = e.getBlock().getLocation();
Server server = Bukkit.getServer();
World world = e.getBlock().getWorld();
MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
WorldServer nmsWorld = ((CraftWorld) e.getPlayer().getWorld()).getHandle();
GameProfile gameProfile = new GameProfile(UUID.fromString("a62fbd6e-6f55-11ec-90d6-0242ac120003"), "micobar69");
EntityPlayer mobara = new EntityPlayer(nmsServer, nmsWorld, gameProfile);
Player mobaraGolem = mobara.getBukkitEntity().getPlayer();
mobara.teleportTo(nmsWorld, x, y, z, f1, f2, PlayerTeleportEvent.TeleportCause.PLUGIN);
Entity mobaraEntity = mobara.getBukkitEntity();
System.out.println(mobaraEntity);
world.getEntities().add(mobaraEntity);
mobaraEntity.teleport(loc);
}
I'm trying to do so with nms
I would recommend citizens
Ok
I need it very simply
oh
no
i didnt mean that
i need very specific behavior
but for very simple cause
i don't need to do it simply XD
i miswritten
what are you looking for?
Do you know how to cast it to EntityHuman? that's what PacketPlayOutNamedEntitySpawn take as an argument
why does it needs to be a player and not an entity?
hm
i don't really see a difference. I need some kind of "Steve" to do at least wandering around, writing chat, and simple interaction events
and really trying to do it with nms
Another NPC plugin?
noo
EntityHuman mobaraHumanEntity = mobara.getBukkitEntity().getHandle();
ok got it
getHandle
a "steve" is just an entity without a skin
i think you are trying to add a skin to an npc?
At first im just trying to even make this npc spawn and be visible
then i'll worry about the details
if you check the link i sent you with the #showTo method that's all you need ._.
https://github.com/JordanOsterberg/NPCAPI/blob/33a71031a46891d3c895a62337cd7d8ed4944877/src/main/java/dev/jcsoftware/npcs/versioned/NPC_v1_16_R3.java#L52
in this github he's using
import dev.jcsoftware.npcs.NMSHelper;
to have sendPacket
just copy that method ._.
yes sorry
i think you need a playerinteractmanager too
it's needed for movement etc.? or to spawn too?
ah here's the video where he explains everything, might be worth checking out
https://youtu.be/Avwg6ZCQX1o
u know maybe how to maven add this dev.jcsfotware?
what
Are you trying to add his project via maven
thats his package name
you could download the jar and build it maybe idk
or just copy stuff
._.
ohhh never mind he wrote sth like
public class asd implements dev.jcsfottware.npcs.NPC {}
i don't see anything wrong in learning
and he created interface
before
He's not making his own if he's copy pasting
my fault
XDDDD
true i'm bad :kekw:
but he should atleast know how to add the npc to the world and make it visible
NPCs and NMS is not what a beginner should be messing with
Use other plugins and their apis if you need npcs
Many servers will have things like Citizens and Protocollib
So just use them
I can show u full code on dm if u want, and as for those markers, it was enough for me to delay their setting by 1 second.
If it's so painful to you to answer in channel help-development u don't need to do so, im just trying to learn this
I know i can use shortcuts like citizens
Shortcuts aren't bad. You can comeback to this later when you have more experience
this tutorial will help me a lot thank you @tardy delta
thanks for trying to help me
How can I get Block name for different language?
event.getBlock().getBlockData().getAsString()
It is possible to lower the entity on the y-axis, but that it still walks on the blocks as if it was not lowered? For example, a pig lowered by 1 block on the y-axis, but behaves as if it was not lowered, so it keeps jumping on blocks, walking, etc. I don't want to use packages here.
You’ll need to add them yourself
Afaik the server doesn’t have any language data
got it
Can you please tell me how to add this citizens api?
hello there, i was trying to filter one or more item in a player inventory, but i can't find the method. I was trying to use the #stream().filter, with no success. Help?
ping me in case
Damn that’s nuts
How to add citizens api or any external lib to developing a plugin? (maven)
The same way you added the api for spigot
It was created automatically with Inteliij
put the dependency in the pom.xml
where to find information about this dependency? (group id artifact id repository url etc)
than kyou 🙂
java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper this happens when trying to instantiating ObjectMapper even though it is implemented as dependency in my gradle file
repositories {
mavenCentral()
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
implementation("org.mongodb:mongo-java-driver:3.12.10")
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.1")
implementation("com.googlecode.json-simple:json-simple:1.1.1")
}
That would mean it's not present on the server
Use the library loader or shade it
and how can i do that?
Which one
Read the 1.17 release post for how to use the library loader
Basically add this to the plugin.yml
libraries:
- com.fasterxml.jackson.core:jackson-databind:2.13.1
Yeah
Hello I made maps look like Xbox edition but there are shadows under the cursor, I am using map initialization event
what plugins do you guys recommend to use on intellij
how can I add lines above the player? I've tried putting an armorstand riding the player but the lines are too far from the name
?
IIrc you can do some tricks with slimes can't you
Small armor stands
Ah
well... EntityPlayer extends some stuff that extends other stuff but at least it extends EntityPlayer too ^^
Hey, I am trying to write a Chat Input API for me with an automatic check if the correct datatype was written.
If I want a String Input for example I use this:
new ChatInput<String>(String.class)
.message(Message.SKULL_INPUT_ENTER_URL.get())
.title(Title.of(Message.SKULL_INPUT_ENTER_URL_TITLE.get()))
.response((input, canceled) -> {
// Abfrage, ob die Eingabe abgebrochen wurde
if (canceled) { // <-- This should be noticed as Boolean
}
})
.start(player);```
But the variables in #response are only comming back as <Object,Object>, even though they should be <String, Boolean>.
The ChatInput Class is on https://pastebin.com/9ttXjgM4, can you help me with that?
they are too high
i'm on 1.8
i've managed to do something like this lol
the line is pretty close to the name
the armorstand is marker and is above the slime
because thats wrong ^^
what happens when i wrap a method that returns something in a CompletableFuture.supplyAsync?
like
where the storage.load returns a D object
its not pain ... you can just spawn a other mob (villager for example) and define its pathfinder-goals/targetgoals ... if a packet with that entity id to spawn is send you just send your player with that entity id .... and all other packets automatically will update your player ...
i dunno how to do that and if it's even usefull in my case
It does, but not much
i'm following conclure's code which he suggested lol
Wrong channel
would be an idea .... i think it should be very simple to spawn some markers in front/left/right/back of a armorstand ... i will test something ^^
so to solve that issue i would need to save my user cache in the same class as the mysql storage logic 😳
and just put the retrieved user inside the cache instead of returning it
you will need to use packets (sending teleport packet to 1 block lower should do this)
wha-
?xy
Asking about your attempted solution rather than your actual problem
not without reflection, but it wouldnt actually change the variable name
and no, you cant name a variable a number anyway
poblem
my fingers are dead
mine are just frozen from walking about college
i think you want to append the data to the string
instead of returning the first line of the file
oh also possible
take a file object or file name as parameter?
also dont make your stuff static
well
public <T> void setJsonValue(T t) {
try {
writer.write(mapper.writeValueAsString(t));
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
this is how i saved it
// onEnable method
JsonManager manager = new JsonManager("database");
manager.setJsonValue(new DBJsonSettings("dbname", "PASS", "CNCTSTRING"));
this is the file from the inside atm
{"connection_string":"CNCTSTRING","databaseName":"dbname","password":"PASS"}
is there a way to make the json format intended? it looks trash as a single line
i'm struggling with the code you sent me 😄
fourteen brush you should know the difference between:
Runnable runnable = () -> System.out.println("hi");
//and simply
System.out.println("hi");```
a runnable is something that can be run in a thread
well
maybe some other purposes tho
the former is only declaring the instruction (and storing it into a variable)
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
what to do when running that runnable, yes
i was thinking the opposite
well
too bad to play mc, lets start coding
its interesting because things like:
Supplier<? extends T> x = () -> new T();
//and
Runnable runnable = () -> T.doStuff();
dont actually run any code or well not the instructions declared within them
similar to when you just declare a method
so learning when an instruction is simply declared and conversely when it is actually performed (would be crucial)
yea i understand
also i'm having trouble with placing the code to get users in the class which is responsable for the db stuff 🙄
?paste
md5 paste broken brr
like rn i have a map as cache in the db class thing
https://paste.helpch.at/tizamesaru.java
well
you probably want to separate the cache (the map) and the actual database itself
yea
i have changed the load method to let it actually return an object (bad) so i could store the retrieved object somewhere and get rid of the map in that class
what I shouldn't have done
what am I saying
nvm
thing is
you want to separate the cache for one sole reason
or 2 actually
first it makes stuff a lot simpler and easier to reason about
and
Well they do run code.
They call an invokedynamic that refers to a bootstrap method returning a Supplier for that set of instructions.
yes but that wasnt my point
:)
its easier to substitute to another impl fourteenbrush
i was thinking of taking an usercache object through the constructor to add the retrieved users instead of saving it locally
like
public MySqlUserStorage(MBNPlugin plugin, UserRepository userRepository) {
well point is, by merely declaring a runnable it wont magically run by itself
I have small problem. I'm trying to use Citizens API. I have plugins on server: Citizens-2.0.29-b2446.jar ProtocolLib.jar And they are loading perfectly fine.
However an error "Citizens 2.0 not found or not enabled" keeps throwing when
if (getServer().getPluginManager().getPlugin("Citizens") == null || !getServer().getPluginManager().getPlugin("Citizens").isEnabled()) {
getLogger().log(Level.SEVERE, "Citizens 2.0 not found or not enabled");
getServer().getPluginManager().disablePlugin(this);
return;
}
Like it doesn't see the plugin even though MC versions are fine and Citizens logs Loaded.
check what /plugins prints out
Don't check is enabled
Might not be fully enabled yet. Also add it as a depend in plugin.yml
also your plugin probably loads before citiziens
Try adding it as a depend first then remove the enabled check
if i don't check anything it still doesn't work.
java.lang.IllegalStateException: no implementation set
at net.citizensnpcs.api.CitizensAPI.getImplementation(CitizensAPI.java:79)
Like it doesn't see the plugin
-It's not :/
At least in console
[15:05:00 ERROR]: Could not load 'plugins/Spigot-ExpTech-Release-Candidate.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:186) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:158) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.loadPlugins(CraftServer.java:422) ~[paper-1.18.1.jar:git-Paper-117]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:285) ~[paper-1.18.1.jar:git-Paper-117]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1202) ~[paper-1.18.1.jar:git-Paper-117]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-117]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.util.zip.ZipException: zip file is empty
at java.util.zip.ZipFile$Source.zerror(ZipFile.java:1598) ~[?:?]
at java.util.zip.ZipFile$Source.findEND(ZipFile.java:1382) ~[?:?]
at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1477) ~[?:?]
at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1315) ~[?:?]
at java.util.zip.ZipFile$Source.get(ZipFile.java:1277) ~[?:?]
at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:709) ~[?:?]
at java.util.zip.ZipFile.<init>(ZipFile.java:243) ~[?:?]
at java.util.zip.ZipFile.<init>(ZipFile.java:172) ~[?:?]
at java.util.jar.JarFile.<init>(JarFile.java:347) ~[?:?]
at java.util.jar.JarFile.<init>(JarFile.java:318) ~[?:?]
at java.util.jar.JarFile.<init>(JarFile.java:284) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:174) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
What's wrong with this?
Invalid plugin.yml
?paste use this next time
Not api problem?
No you messed up your plugin.yml
i did?
No
ok
What version of Spigot are you using? Also check console for any messages from Citizens
Paperspigot (git-Paper-117) : v1_18_R1 (Minecraft 1.18.1)
There is message from citizens
that it perfectly [Citizens] Loaded 0 NPCs.
People who say newest or latest are almost never on latest
and commands from
citizens work too
Paperspigot (git-Paper-117) : v1_18_R1 (Minecraft 1.18.1)
i don't get the people who use packets for scoreboards actionbars and tablists
sure i used packets for glow coloring, but i hooked it up to scoreboard API back
people say its more performant
THEN JSUT DONT USE THE FUCKING API at all
IT WOULD BE PERFORMANT
what is the packet to make an entity ride another?
i did and i wasn't able to find it
It's there
h3lp
for me, packets are used whenever API doesnt have the implementation (for example 1.8 bukkit api doesnt provide method of sending actionbars, thus you use packets to send it yourself)
How are you using the Citizens API also show your plugin.yml
not even gonna mention how many conflicts sending packets for scoreboard cause
i am trying to make sort of an api to add lines on top of the player's name and i'd rather not have real entities for that
i use scoreboard packets in 1.18 for a playerteam that is for an custom entity and should not stay in memory at all
name: Mobarobot
version: '${project.version}'
main: ttomek.mobarobot.Mobarobot
api-version: 1.18
authors: [ ttomek ]
description: a
website: cyber-man.pl
huh
the entity is not even real server side
so the server won't know about it
You're not depending on Citizens like I told you
im using it in pom.xml
<repository>
<id>everything</id>
<url>https://repo.citizensnpcs.co/</url>
</repository>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizensapi</artifactId>
<version>2.0.29-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
its a bit more complicated and since the name of the entity contains § to make the name invisible the player CANT EVER create an playerteam with that entity ^^
can you do smt like
command:
name:
permissions: [plugin.a, plugin.b]
Entity can only be in one team at the same time (Mojang pls fix this)
Does make sense though
also mojang dont want UUID to work with playerteams which sucks too
so i can use normally citizens classes etc
you can have multiple NPC's
with the same name
and apply the same team, just because client thinks thats the same dude
I'm following https://wiki.citizensnpcs.co/API
even if UUID is different
so anyways whats the packet
my plugin is working on spigot
Using the CitizensAPI
i set the Npc-Name based on the UUID with § as seperator to make in insisible at all ... so (i hope for a long time) the names are unique
can you do this?
Yeah it says jar file empty. Try reuploading it
yes but then you need to simulate player's name which require more work if you want to display another name
i myself use negative entity ids both for spawning and
thats why i use a PlayerTeam in nms ... which also displays the health ofthe entity
for NPC names
so first of all i should make my load method returns void?
since Notchian server increments entity id from 0
and negative entity ids in notchian server vanilla is impossible
but how do you hide the -ID name with another name then
Team packet
to hide nicknames
inside the team
and create another packet entity
or rideable
to simulate nickname
that's just shitty way to do this
but now i hooked it up to NMS like you do with PlayerTeam
just because i want to be synced with server
i wouldnt really make sense to not do it, as a completablefuture is wrapped around and i cannot return the object
can you do this or nah
so what is the packet to make an entity ride another
sec lemme try to find the class
only thing here is that i'd would to get a future with the retrieved object in here
instead of a void
oh i've found it thanks
do you can remove the name with teams and set prefix/suffix to set another name too ??
light craft modpack
you can do all the scoreboard operations with packets.
i get 450 FPS
on 1.18
via this modpack
with 32 chunks
and fancy graphics
no i mean isnt the playername invisible and so its prefix/suffix too ?
nametag is invisible completely
although i know there was a bug with 1.8* client
where the prefix or suffix were visible
when the players vanish
?paste
I have created a gui so how can I make it so that if the use it , it will telephone to another world which I created using multiverse?
dont know telephones exists in minecraft
how can I set firecharge that it destroyes more blocks
for now I have this code: e.getPlayer().launchProjectile(Fireball.class);
How to make it execute a specific command?
in teory this method return the projectile... then you can change the damage?
this or catch in event when this projectile hit and change the explosion
anyone know why this doesnt do anything? supposed to change the damage done to a player from whatever to 100
public class Main extends JavaPlugin implements Listener {
@EventHandler
public void onPlayerDamage(EntityDamageEvent a) {
if(a.getEntity() instanceof Player)
a.setDamage(100.0D);
}
}
you register the listener?
did you register it
that depends on your gui implementation, but executing a command is java Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "your command")
@dark arrow
Yes?
how do you register a listener
but to set the entity launch speed I must do setvelocity?
??
Read the message he sent?
Ok tysm
I didn't noticed that sorry
Hey, I am trying to write a Chat Input API for me with an automatic check if the correct datatype was written.
If I want a String Input for example I use this:
new ChatInput<String>(String.class)
.message(Message.SKULL_INPUT_ENTER_URL.get())
.title(Title.of(Message.SKULL_INPUT_ENTER_URL_TITLE.get()))
.response((input, canceled) -> {
// Abfrage, ob die Eingabe abgebrochen wurde
if (canceled) { // <-- This should be noticed as Boolean
}
})
.start(player);```
But the variables in #response are only comming back as <Object,Object>, even though they should be <String, Boolean>.
The ChatInput Class is on https://pastebin.com/9ttXjgM4, can you help me with that?
no lol
kekw
It’s deprecated anyway
is there a way to save an object that extends ConfigurationSection into a yml file such that it retains the object-mapping for when it is read back?
currently when i save this it's being saved as raw yml, so it's failing to read back
iirc you have a serialize and deserialize method that should exactly do that ^^
of course you have to implement those methods and reset your stuff too ... but it should be possible
can I modify an entity's hitbox? I'm making sort of an api to add lines to player names and i have a slime on top of the player and i'd want to remove its hitbox
so I'm getting an error when I read it 😦
No, hitbox is client side
do you use nms ? then the slime shouldnt be a problem (for the server)
yup
the idea is playing a spawnentity packet for the slime, a packet to make it ride the player, another one to spawn an armorstand and a final one to put the armorstand on top of the slime
why armorstand at slime ?
because if i put a stand on top of the player head the line is not placed on the spot i want
if the stand is marker it clips in the head
if it is not it's too high
even with small stands
this is the result with a slime
update to 1.18 and use areaeffectcloud 😄
i mean if it was for me i'd do it
anyways what did you mean by this?
because my GameConfiguration object extends MemoryConfiguration it's not serializing like a normal ConfigurationSerializable
any ideas for how to fix that?
the stand has not hitbox already because of the marker flag so its fine
what if i use bats, theyre kinda small
hmmm
the problem is the slime hitbox clientside maybe
Correctly implement ConfigurationSerializable, and register your class
I was going to say.. extending MemorySection is not the way to go about doing this
you mean that player attacks may be redirected to the slime hitbox
i've been using configurationserializable for years, I haev implemented it correctly
yea that'd be an issue
public GameConfiguration(Map<String, Object> data) {
extractData(data, "");
}
@Override
public Map<String, Object> serialize() {
return getValues(false);
}
all the requiresment are there, and this class worked fine before
however it now extends memoryconfiguration
and now it no longer works
👀
where are you registering the class?
i added it in and ran it again in that test method, this is part of a much larger project
i know it's registered
You seem to not to want to answer this question
i just did?
No you didn't. You just said it is
yo rabbit is perfect
is he sitting on you?
it's mounting me yes
but you would need to make it invisible ... which also removes the name ?
Don;t extend MemorySection as thats basically a wrapper for a Map. Implement COnfigurationSerializable only
kinda cute
lemme try to add another one on top lol
oh
lemme try rq without packets
maybe i should just recap what I've already done -- this class has been in operation in my code for a little while and worked, but during refactoring i have now altered it to extend memory configuration directly rather than wrap it (it makes sense based on how the object works to gain full memory configuration rather than wrapping every method). now that i extend memoryconfiguration directly, all my serialization code broke
trying to see if there's a 'simple' solution that doesnt involve recoding all my file managers
I know but way too many shitty plugins (EcoEnchants, I am talking about you!) are listening only to this and not the "new" event (which exists since like 5 years...)
maybe i dont need the wrapper at all and should just use memory configurations natively? what my wrapper adds are two primary methods:
/**
* apply a set of configuration values to this GameConfiguration
* <p>
* any config settings already set for a given key will be overwritten. This
* is particularly useful for applying per-game/per-arena configuration changes
* to a set of defaults by simply applying the default settings first and then
* applying the customization settings on top of the defaults
* </p>
* @param data the data values to apply to this GameConfiguration
* @param ignoreNulls if keys with null explicitly set should overwrite existing
* config values (false) or if null values should be ignored (true)
* @return a reference to this (the edited configuration) for chaining
*/
public GameConfiguration applyConfiguration(Map<String, Object> data, boolean ignoreNulls) {
for(Map.Entry<String, Object> entry : data.entrySet()) {
//skip sections that have further sub values
if(entry.getValue() instanceof ConfigurationSection) continue;
if(ignoreNulls && entry.getValue() == null) {
//skip
} else {
set(entry.getKey(), entry.getValue());
}
}
return this;
/**
* get the configuration value for the given key
* @param key the (case-sensitive) key for the config value
* @param expectedType the expect type of the config value
* @return the config value stored for the given key or null
* @throws ClassCastException if the expected type does not match the actual type of config value
*/
public <T> T get(String key, Class<T> expectedType) {
return expectedType.cast(get(key));
}
public <T> List<T> getAsList(String key, Class<T> expectedType) {
return (List<T>) getList(key);
}
public GameConfiguration clone() {
GameConfiguration clone = new GameConfiguration(getValues(false));
return clone;
}
clone and applyConfiguration (essentially a way to overwrite values)
does memory configuration support this natively in a way that i missed?
yeah you're right
sad
I have Citizens-2.0.29-b2446.jar on my spigot 1.18.1 server with all libs. Loading just fine.
I have added depend: [ Citizens ] to my plugin.yml HOWEVER
this: ```java
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "mobara01");
Produces error:
Caused by: java.lang.IllegalStateException: no implementation set
at net.citizensnpcs.api.CitizensAPI.getImplementation(CitizensAPI.java:79) ~[?:?]
at net.citizensnpcs.api.CitizensAPI.getNPCRegistry(CitizensAPI.java:111) ~[?:?]
Like citizens didn't load. (commands from citizens works etc)
i tried changing citizens version
only thing that has still a name in invisible is armostand iirc
map.forEach is less brr than Map.Entry
you have to write your own implementation?
i guess
bat + stand
wdym
thats what it says
Doubt it
thats what i find on the dev page
Yeah we've tried
Does PlayerPortalEvent get fired even if the nether and end is disabled?
I was trying to but it's not firing
please
Interesting question
for the people of future, it may help ya
is this something?
No
some1 know how get the vector from a armor stand headpose?
no not necessary
do u know hot to make a link
yes ._.
it's good that you're here because you can probably help me, let me show you
May i ask you to show me how to link this main?
for some reason when i call getPluginConfiguration() it retuns YamlConfiguration[path='', root='YamlConfiguration']
I have citizensapi in pom.xml imported dependency
Citizens has an extensive API that can be used for making your plugins work with NPCs or even for adding a brand new character that can be attached to an NPC. Make sure you always are using an up-to-date build of the CitizensAPI to ensure that your plugin works with the latest release of Citizens.
public final class Badbox69 extends JavaPlugin {
private final FileConfiguration config = new YamlConfiguration();
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new BlockBreakListener(this), this);
this.loadConfig();
}
private void loadConfig() {
File configFile = new File(getDataFolder(), "config.yml");
if (!configFile.exists()) {
configFile.getParentFile().mkdirs();
saveResource("config.yml", false);
}
try {
System.out.println(configFile);
config.load(configFile);
System.out.println(config);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
public FileConfiguration getPluginConfiguration() {
return this.config;
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}```
why??
?
config.yml is loaded when you request it for the first time, whats the point of this?
Just run saveDefaultConfig
Also I’m pretty sure saveResource handles missing directories anyway
rotation ?
I'm trying to make a way that the armor stand spawns more centered on the weapon
it frustrates me
If i log it, the value is YamlConfiguration[path='', root='YamlConfiguration']
the path is empty
Read what Coll said
Idk what but some fanciness is going on here
what are you trying?
why are you logging it
resourcepack
what?
what about armorStand.getEyeLocation() and armorStand.getLocation() -> subtract y to get middle Y ?
Not sure if you meant to reply to me
dont work
let me show you what happens
without resourcepack
I tried debugging my code because the code didn't work as intended
btw can you create those hologram text with a plugin or is it just resource pack ?
basically, I turned an item into the position that it lays on the block, it totally changes the item's original position.
Ok i have changed it to main but still Caused by: java.lang.IllegalStateException: no implementation set occurs
And config.getName() returns an empty string
both
Comic remove all your stupid stuff that isn t needed and all you have to do is in your onenable run saveDefaultConfig and then you can get it by JavaPlugin#getConfig
You don't need a custom implementation for it
then what isnt working?
getting boolean values from the config
what i need to do?
so i dont need to make a variable and do the config.load stuff
Not at all
if you want to test your self
There should be a getDirection method
like as I said before
Please tell me you haven’t hardcoded Pi
the display text ... what is this ? is it a map or custom armor stand model ?
armor stand with a block item in head
you could set the armorstand as passenger of the item
LMAO
won't work very well,~~ i think~~
🙃
because I practically know the headpose of an armor stand and that would give conflict, unless I transform the position of the model and make it stand up, but that will be a problem when I try to make the armor stand spin around the player
hmm the batteries of my mouse died and i cant continue coding 🥵
Hate when my mouse dies especially if I'm playing Apex Legends
My teamates hate me too when that happens >.<
people use wireless mouses? o0
Sure
i dont rly understand your problem... it should be very easy to set the text above the item ....
What if I need to take it into another room
yes man
Yeah I have a G602
why though
why not*
Because usually you do not need it
I change the position of the item on the head of the stand armor so it looks like it's lying on the ground, you know?
if you go on a date you probably want to click with your mosue too
try test this code
intellij without mouse is a pain
i had config instead of drops
my fingers are already... i dunno they're fellin weird
Press shift twice to search all actions makes things easy
isnt every item almost same height ? and also the position of it with getLocation always the middle ?
iknow i would never use that
You need to go through the phase of not using a mouse
There's reasons I have so many hotkeys
I decrease the height of y location, to make it look like it's on top of a block, because otherwise it's floating
but why should the value for that dif change for every item ?
because there are different angles that stay in hand*
sorry i miss, im using the item on hand
because I want this to stay in the 1.8 versions too
ok more confusing now... why do you need the item on hand to change the height of an armorstand above an item at the ground ?
because in version 1.8, you can't use item stacks in the head of the armro stand, the client sees nothing in his head, so much so that these versions only blocks in the head are fetched, that's why I'm using the item in my hand
I need to change the positions because in my hand, the angle of visibility changes, that's why I need to change the position, let me show you how it looks
blocks
tools
default items
and those different hand-item-shapes affect your armorstand that is on the ground above an item ?
yes
makes litterly 0 sense to me
therefore different euler angles, and are the best possible to stay at the head of the armor stand, and stay straight
just try your self
just spawning an armorstand above an item and changing its y-value
thats all i would do to set your custom item name stats thing
no man, i'm talking about the item in the hand to look like it's on top of a block
is the same position, let me show you how looks then
Okay, vim lover ;)
emacs
you dont use an item you use an armorstand to place an item ^^
and because of that the height of the armorstand changes and thats why you want to modify the height of the display armorstand
soooo and your problem was that the display armorstand is not always at the same height you want it to be for all items since the itemarmorstand has different y.values ?
you would need to hardcode this too
What do you think about access to sql, or data files in events such as PlayerMoveEvent or InteractEvent ?
Cache
^
is there a better way to construct and return an object async than having a void method which actually constructs it and puts it in a map and wrapping that with a completablefuture?
(and when the future completed getting it from the map)
Such as ConcurrentMaps, HashMaps ?
SQL query on player move 🙏
Mhm
Best with mysql
Yes
Do getOfflinePlayer for every word in the message
Then execute a query for each result
Mojang has already got that covered
hmm that are many web requests
Is it okay ?
Yeah keep data in maps
bump 👀
Oh okay, it's 'cause I always have a trouble with optimization and I'm always trying to have my plugins to optimized I also use cache pulling that each x of time to the files to free ram memory. But idk why I'm always having a trouble with it 😂
You still trying the code Conclure sent?
in some way
If so just skip it. If you've been stuck on it this long creating your own system that you understand is probably a good idea
in fact its really good code
i'm just trying to divide the db stuff and the actual storage
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
when im trying to enter a server its not entering
hwo to right click strik lighting
World#strikeLightning
Listen to the interact at block event and ^^
Maybe just PlayerInteractEvent
Yeah?
🫒
Yeah
instead asking for help you could just tell what the problem is
That's the point. You learn the basics and then make harder thing with it
go check out collections
Have you read this
it doesnt tell much w3schools
Yeah w3schools is a good site
baeldung is better ._.
It's good too
Wut
Not really
Pretty sure no
I haven't tried scratch in years but that sounds wrong
It’s an example
thats why w3schools is bad to study
wanna see more avanced stuff?
no not that kind of stuff
Ah this one is deffinetly better
Well yeah
there's the stuff you asked for
It's a lot to read about
concurrency is a pain for me xD
what's the nms method to set an armorstand marker?
hmm how/where/what method sets the item in an villager hand ?
setItemInMainHand
not sure if it exists in the api unless the methods from Inventory work
i dont search for api tbh... something in the nms.Villager changes the item in his hand
Have you even tried this
it's n()
thanks spigot obfuscation
say i have a maze with some paths leading to B, and i am at A, given the fact that i know every block in the maze i can walk on, is there an algorithm that can find the shortest path? (And would breadth first search work with this? note: i do not know in advance anything about the maze, only the blocks i can walk on and if the block is the end or the start or a segment)
google A* pathfind
fair enough, also another question, say i have elevation, should i start at the highest point? because for example default mc ai when you build a staircase and bridge out a few blocks goes under the bridge rather than on the stairs
fair enough again
lol
I have one you could base yours on
whats the difference between @NotNull and @Nonnull?
idk
what is the boolean parameter in PacketPlayOutEntityMetadata's constructor for?
i think are from different annotations not?
I was confused as i've never really seen something like what i am trying to make (i am 101% sure it was made already), so i didn't know a* could go up stairs n stuff
Of course it can
A* is a general purpose search algorithm
You can adjust it to find a path on just about any kind of graph
This works for all sorts of things
Not just pathfinding in a literal sense
You can use it to solve Rubik's cubes and sliding tile puzzles
:O
If you have nodes and you can get all nodes adjacent to any given node, and you can calculate the "distance" between two nodes, and you know the starting and ending nodes, you can use A* for it
Can I use it to solve who the best ninja turtle is
hopefully
and can you use it to find out why my stand doesn't have a name even tho i send the metadata packet
and also why is my packet slime not invisible
(that is a real question)
check for entitydamagebyentityevent
get the attacker
get the inventory
get item in main hand
on 1.8
yes
there is no getinvetory
oh right, you need to check if the attacker is instanceof inventoryholder or something similar
Thats very clear xd
LivingEntity should work
yeah that's what i do but i was looking for the exact interface
but i'm not sure if an entity can be a non living one but an inventoryholder
lol
ive always found it weird
well now i know why
nice
just need to figure out how to make the squid invisible
i've tried squid.addEffect(new MobEffect(14, 100_000, 0, false, false)); but ehh it didn't really work
yeah, i can't figure out how other servers did it
mineplex uses squids too i've read somewhere
Actually you could use teams
well i can't figure another way to slap lines above the player's name
Take a look at TAB (that tab plugin)
Its open sourced
THey have custom nametags with armor stands
You could listen for incoming player movement packets and apply the movement to an armor stand as well
So it’s not actually riding them, therefor you can control the height of it
well handling lines above the name like that gets messy
especially if there are lag spikes
Not really
If the player is lagging you won’t get any movement packets, so they stand will freeze too
i mean if the server does
but the player can move while lag and its upper name stands still ... rly bad
and even with close to optimal conditions it still looks messy
thats how hypixel's statuses work
Server lag shouldn’t matter much either, packets are on a different thread
they lag behind when you lag
I’m pretty sure that’s how wynncraft does it
what statuses?
But via outgoing packets instead
you mean levels above head
So im storing a list of objects in a yml file using Bukkit's FileConfiguration object. How would I then get the list of objects progrimatically?
how would I do it with teams?
Actually it should be easy to avoid the hit box issue
Just don’t send the mob packet to the player it belongs to
Generally you don’t want to see a floating name if you look up anyway
its not this; but i found that the fucking brain of an villager is to good .... so i needed to reset the brain ^^
dude im slow
that was my plan
wait what if a player attacks the player with a squid in the head
That's where the problem starts
i guess i have to redirect attacks
Anyway teams can be used to stop attacks
Make the squid the same team as the attacking player
You could technically force the villager to keep holding the item by setting it every tick
But that seems less than ideal
how does the constructor work?
🤷♂️ I don't use 1.8
just resetting its brain since he doesnt need to use it seems to be better
@misty current did you try to use a slime with size -1 ?
now try the full thing there 😄
Wait that works lmao
wait what
wat da hel
so i make a silverfish tower
and then put a slime
oo that might work
lemme do some testing
its very useless tbh ^^
Yeah
armorstand riding slime(size=-1) riding player ?
I'm having some issues with a BungeeCord plugin.
Below is the task that doesn't seem to be working.
I have attached the Main and MySQL task for reference.
package com.gabrielhd.bcredits.Task;
import com.gabrielhd.bcredits.Main;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.config.Configuration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.TimeUnit;
public class CountTask implements Runnable {
@Override
public void run() {
final Main main = Main.getInstance();
Configuration config = main.getConfigUtils().getConfig("Settings");
final int countTime = config.getInt("Counts.Time", 999999);
final int countReward = config.getInt("Counts.Reward", 0);
for (final @NotNull ProxiedPlayer player : main.getProxy().getPlayers()) {
if (main.getJoinTimeMillis().containsKey(player.getUniqueId())) {
final long joinMillis = main.getJoinTimeMillis().get(player.getUniqueId());
final @Nullable Long maybeLastPaidMillis = main.getLastPaidMillis().remove(player.getUniqueId());
final long lastPaidMillis = maybeLastPaidMillis != null ? maybeLastPaidMillis : joinMillis;
final long sinceLastPaidMillis = System.currentTimeMillis() - lastPaidMillis;
final long minsSinceLastPaid = TimeUnit.MILLISECONDS.toMinutes(sinceLastPaidMillis);
if (minsSinceLastPaid >= countTime) {
main.getProxy().getScheduler().runAsync(main, () -> {
final int existingPoints = main.getMySQL().getPoints(player.getUniqueId());
main.getMySQL().setPoints(player.getUniqueId(), player.getName(), existingPoints + countReward);
player.sendMessage(Main.replaceAmpersand(config.getString("CreditsReceived")));
main.getLastPaidMillis().put(player.getUniqueId(), System.currentTimeMillis());
});
}
}
}
}
}
i don't really get what should this address since some entities still go through the player's hitbox
player.sendMessage(Main.replaceAmpersand(config.getString("CreditsReceived")));```
This line seems to work, as I get a message in chat. However, even when i set `Counts.Time` to `1` for 1 minute, it still runs once about every 30 seconsd.
I'm more familar with the Spigot task API so forgive me if I'm doing with something wrong
Can Bukkit.getPlayer(uuid) get an offline player?
No
Sad
is the slime rly greater then the playerhitbox ?
if not you can try set armorstand on it ...
Use getOfflinePlayer
alr
yeah you can see it poking through
Make it invisible?
So im making a bounties plugin
For storage
Should i make a list of active bounties, and have those bounties have a unique ID for every player that is hunting that bounty? Or should i have a list of players, and a list of bounties. And have the bounty tied to the player?
What would be better?
With the first one, when a bounty is claimed
I can just loop through all the players that have that bounty active
And remove them from that bounty
hmm i would use Map<TargetPlayerUUID,Bounties> or smth like this
hmm, ig that does work
Wait, i would have to have a seperate list of bounties and instead of mapping plrID to bounty i would have to map plrID to like a bounty UUID
Also is creating a new UUID 100% unique?
Like hows that work
Add another entity with player name
that works
almost infinity 99,9%
if you can create multiple bounties for 1 player you should use my map ...
I think what imma do is create a list of bounties, each of these bounties has a UUID, then make a map of plrUUID, List<bountyUUID>
what i can think of its in many cases better to have directly a method to get bounties for a player and not loop through all bounties
that way players can claim multiple bounties
ye does the thing i said make sense
for that
yes
I would have to loop through the bountys tho
if player claims all bountys for killing someone at once ?
wdym?
if a player can have more then 1 bounty ... what does the killer get ?
The "hunter" can claim bounties
There is a limit
So like ranked players could claim 3 while unranked can claim 1
then looping through all bounties for 1 player is way better
OK, so what i think imma do
? im kinda stuck here
?paste the part where you run this Runnable and create it
(For bounty claim storage) A file with a map of plrUUID, List<claimedBountyUUID> and a list of active bounties (Bounty object that stores other objects such as UUID, bounty player uuid). When a player wants to claim a bounty it would just get the UUID and add it to the players list of claimed bounties. However when a player kills someone, it would have to loop through the bounties and see if there bounty is on that player. That is every player kill (wich doesnt happen often so..). Then if there is a bounty, we now have the bounty and can just do getUUID, and check the map for hasValue
@spiral light
this.getProxy().getScheduler().schedule(this, new CountTask(), 10L, 10L, TimeUnit.SECONDS);```
in onEnable
and what is not working ?
it runs more than once a minute and it doesnt seem to do anything with the sql
those sql operations work when used in a command but not in the task
i attached both classes
wait, i can store a map of UUID, Bounty
and can use getKey rather than loop through bounties
did you try to run with debug ?`... i think you dont run the sql stuff because of conditions or because Async(dk if async works there ^^)
System.out.println("i am here code")
it clearly gets past sendMessage
and the SQL code is known good
did you debug what the setPoints should set and what was before ?
i can
Alright
so i caved
im using lombok
should i pile my geter and setter things on top of each other?
whats the proper format
using public instead of private 😄
not using lombok
however you like
I do it in the same line if it's only one annotation and a separate line if it's more than one
lombok what ?
however I'm nasty anway. Because for Override, I always use a separate line and then include @NotNull final in the parameters lol
oki
idk
lombok is an island ^
I dont like it so far
isn't java too?
lombok is awesome
e.g. @Data, @Builder or @hoary knollThrows
No promises
oh sorry for ping
lombok @Builder is confusing
I wanted to say @ SneakyThrows
lol i had that with @ event
its very erratic
gtg
19:36:31 [INFO] Player has 0
19:36:31 [INFO] Player now has 100
19:36:51 [INFO] Player has 100
19:36:51 [INFO] Player now has 200
19:37:11 [INFO] Player has 200
19:37:11 [INFO] Player now has 300
19:37:31 [INFO] Player has 0
19:37:31 [INFO] Player now has 100
19:37:51 [INFO] Player has 100
19:37:51 [INFO] Player now has 200
19:38:11 [INFO] Player has 200
19:38:11 [INFO] Player now has 300
i dont know whats wrong with my database
also it runs at the wrong time
Does anyone know where the NMS jar is so I can add it to my build path and use nms methods? It seems the spigot jar in the target-api folder only has the bukkit api classes and not the nms ones
i remember when i used to do that
😔
I also used to use eclipse
But i have been enlightened
I've been trying to use gradle, can't figure it out. I have gradle installed and my project is a gradle project in eclipse, and my build.gradle has stuff in it, but it is not doing anything.
does lombok create comments too xD ?
Start by putting all of your dependency in your build.gradle
i dont think so
Anyone great with MongoDB ?
this is what I have in there for dependencies
compileOnly("io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT")
}```
Are you using the Paper API or can you use the spigot one
run buildtools --remapped
I can use the spigot one
will try this as well
All right then do what mfnalex said
fuck this trader lama guy
auto shulker .... i wanne hear more about that 😄
ok I did this, where should the nms jar be?
That's not worldedit?
import it with maven / gradle
DM me your spigot name and I'll gift it to you
nah worldedit would be easy but its probably not a server 🌝
ah it is 🙂
I'm glad I'm not the only person who grabs a jukebox and plays minecraft music while showing off a plugin
"shit the color code is still bugged lol" i love it
So how exactly do I do this. Do I just put a file path in the dependency section of gradle?
did I write that somewhere? lol
in the video
aaaah lol yeah I remember
if i let storage.load return an object and i change it to supplyAsync will it work to return a future with the retrieved object? I guess it will
I'm too much of a perfectionist to keep that in, I usually fix it then remake the video
I'm too lazy to make proper videos and descriptions
although I was kinda dedicated on angelchest to make good videos about it
mm
Here is a snippet for yall ```(allowedToBypass(target) ? "true" : "false")
or yk
just do the other way
(allowedToBypass(target) ? "true" : "false").equals("true")
(allowedToBypass(target) ? "true" : "false").equals("true") ? "true" : "false"
((allowedToBypass(target) ? "true" : "false").equals("true") ? "true" : "false").equals("true") == true
That's your snippet 😳
uff
((allowedToBypass(target) ? "true" : "false").equals("true") ? "true" : "false").equals("true") == true && true != !true
how !true is valid java
Syntax asks for !<expression>. Since an expression can be a literal value, and one of the literal values is 'true', it compiles.
nice title
Yeah
sometimes guava is doing weird things
Yeah
thats two times yeah rn
Yeah
and we go to three ladies and gentlemen
Hi, people! How are you? Is there way to hide player armor and head nameta but without hiding him from tab?
i'm fine
I think someone already asked before but i cannot find the message
better than "Hi Spigot!"
Teams and modifying the equipment packet
Allright i will need to have injected the player via netty?
So i can works with packets?