#help-development
1 messages · Page 40 of 1
You can just save bunch of time using bash
then copied it to like 5 other drives
we also had to save ip and mac addresses to put on a spreadsheet
so yeah I made it in java
about 200 lines
not bruh, even simplier use bash
saved the computer's id, mac address and ip address on a .txt file on a special folder
then I'd get home all night, just stick the drive in and fill up the spreadsheet in like 5 minutes
we did about 2 weeks worth of work in 3 hours
bash idk
ItemStack item = p.getInventory().getItem(0);
if(item == null) {
p.sendMessage(ChatColor.RED + "Target slot is empty!");
return;
}
ItemMeta meta = item.getItemMeta();
if(meta.isUnbreakable()){
p.sendMessage(ChatColor.RED + "Target is already unbreakable!");
return;
}
if(!(meta instanceof Damageable)){
p.sendMessage(ChatColor.RED + "Target has no durability!");
return;
}
interestingly the first 2 ifs work flawlessly, but not the last
sysout(meta)
it returned
org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMetaItem
which i guess is correct
on a granite block
Yes its correct
if (meta instanceof Damageable) { p.sendMessage(ChatColor.GREEN + "Target has durability!"); return; }
Try like that if it works
it does .__.
both damageable and non damagable items will go through this code
so that wont work
it seems like just about any itemmeta is an instance of damageable
try checking damageable.hasDamage
will that return even if an item is at full durability?
still lets items without durability through
this happens only on spigot server https://pastebin.com/jCgQyWr2
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
anyone know how long premium plugins take to get accepted? ive seen forms but they are like 4 years old so im assuming its different
You could add debug inside the even and you will directly see if the is new world or old 🙂
Is there a way to check if a block is within the world border?
anyone know if there is a mine reset API? or lib
alternative solution: getType#getMaxDurability > 0
Why doing just do:
MineReset mines = (MineReset) getServer().getPluginManager().getPlugin("MineResetLite");
if (mines == null) return;
mines.doStaff()
and nullcheck
Yeah thanks for telling it fourten
how do i add the dependency
Just import the jar in your project
And them find the main class name
PluginManager#getPlugin("name") will return you a singleton instance of the main plugin class
Also you can import in maven as
<scope>system</scope>
<systemPath>path/to/file</systemPath>
That's deprecated
Oh right i didnt know
I figured it you but you're not going to like it 
Install the jar to your local maven repo instead
why not...
could someone explain what exactly these do?
i have a rough idea, im just not sure why theres a delay option
?jd-s
it’s the initial delay before the first run, and then how many ticks between each one
might be wrong but you can check it out
https://youtu.be/QFc88PCiXOQ
lemme listen to daddy mikes voice
when the bee goes tududududu
removeIgnoredBeeTags removes most paper tags
but doesn't remove custom tags
I already looked into it
I cant check until later
Yeah, that's what I'm seeing.
that mic doesn't have any background noise
the poor bee looses its data 😢 😢
where's the background fan and mouse sounds
I want to hear pc noises
The solution to this issue is simple, either don't use CraftBee or make your own custom entity tile entity if you can even do that
mike
what if
we make our fancy entitytype
because your example just uses the bee entity type
hm
I rememver vivian having a problem where he wouldn't know if it was a minecraft bee or his custom bee
but looking at the internals suggests that this might work
Maybe? Not sure if the reg can be frozen
i have a custom events question
I have a custom events answer
lovely
i was typing it lol
lets say i have an event that gets called when player gets coins
some random currency
crap i dont even know what im asking
forgor the question
💀
OK
Stop drinking and coding
if i have a custom event that has methods to set value
Why do items given by spigot have 2 tags on them?
and i call that custom event inside a EntityDeathEvent
and set values inside that entitydeathevent for the custom event
will the changed values run when i make a listener for the custom event
lol
@echo basalt Do you know how to see the unmapped stuff? I have an idea
I do
nvm got it
you gonna do reflections?

Stop asking in every channel
I'd recommend #help-server and pinging upper staff
I am sorry.
Ok sir
I already downloaded the latest stable update so
try dev builds
NMS makes me want to NMS myself
nms is fun wdym
I love getting to know all the internals
been doing obfuscated nms until about 3 weeks ago so this actually brings me joy now
how would i go about spawning ambient particles such as void particles ? around a lobby or something
but only temporarily
well, there's World#spawnParticle
well yes i'm aware
im thinking about everywhere around the spawn and theres got to be a better way than spawning hundreds of particles
well i dont think so
i mean
there's the offset parameters - maybe theyre the "distance" in which the particles spread out?
idk i never used particles
uhh
you can spawn fog particles by making a bossbar
but you gotta have a bossbar you can't really hide
I mean you can try calling setVisible(false)
interesting
what about the void? thats pretty much endless particles
is there a way to spawn them above the void
that's rendered client-side
the boss bar fog should give a similar effect
yes
oh righ
when you say fog
what do you mean
because most people disable fog in their video settings
and that isnt even particles
see..i wasnt doing it wrong its just mc being dumb af
I'm not sure, it seems like the data should be there. You just need to remake your entity technically. I'm looking into something else though..
Would it be possible to get all armor stands in a world even if there is no player loading it?
7smile7 made me a method to get nbt stuff from entities a few days ago that I just remembered, but it combines them all into a string
but it could probably be modified...
Whenever I try to create a world, it times out
ok so.i have some sort of method
but this was 2 thousand particles, and only a 5 by 5 box of particles
not nearly enough for what i want
infinite loop
?
Im loading a world using this code:
public static World generateWorld() {
WorldCreator wc = new WorldCreator("map");
wc.environment(World.Environment.NORMAL);
wc.type(WorldType.NORMAL);
map = wc.createWorld();
return map;
}
im not sure about this stuff but should it be async
servers will time out after a while of non response, and that method will take a while to complete
and nothing else can happen whilst its running if im correct
but i would wait for someone with a better knowledge lol
Your server has not crashed. Its till generating the world. It even says 45% half way through your crash
I think you are right
its taking too long, probably a very weak host/slow HD
[12:12:06] [Worker-Main-7/INFO]: Preparing spawn area: 45%```
I'd guess you have a VERY slow storage (HD)
how do i make a crafting recipe from custom items? like a pickaxe from iron ingots named "steel ingot".
i tried everything i can think of.
i cant find any tutorials
i learnt entire java and plugin dev yesterday.
what about what LightFury102 said?
ShapedRecipies
give tge result itemstack the name
not the result but the materials
i managed to rename the result
but thats ItemStack and the input is Material
yeah you cant atleast im prettysure about that
what does Material.CreateBlockData do then? i thought it modifies the Materials meta
but i could not get it to work
in spigot.yml change timeout-time: 60 to something much longer, like timeout-time: 5000
can;t do worldgen async
Not on Spigot
So I’m not currently at my pc, but I’m trying to think of how to fix a problem I have been having with a plug-in.
I have a list of spawners stored in a gui. In each spawner there is a PDC containing the type of spawner + the last time xp was generated. The xp bit has been working great, However I am trying to implement drops support so people can collect the spawner drops.
My idea for how to do this was to add another PDC for the last time items were generated, but that won’t work as I want them to be able to take just a few items at a time.
Essentially I need to figure out how hypixle skyblock minions work, as that’s the exact type of storage I am trying to achieve here.
I can’t figure out how to calculate the drops
Long story short
you cant?
no
very
why not?
i need help with ambient particles
smoke_large seems to be the best bet, but they dissapear way too quickly
and spawning them constantly will decrease performance
is there a way to set their decay time
You can test it if you want. Just throw yoru worldgen code in an runTaskAsync
or whatever its called
Particles have a fixed animation/life
ah shet
you can control their position and direction/randomness is all
hm ok well
how should i go about creating a cloud that will obscure most of what's behind it
does areaeffectcloud have that option
i was think an explosion but that only lasts for a fraction of a second and lags the client
think less of making a BIG wall to obscure, and move them much closer to teh player to obscure each players vision
You can spawn a lot less particles then and have them much denser
so basically i have 8 'gauntlets' surrounding the player(s) and i want them all to become obscured temporarily whilst i do some particle show or sum
but i wnat the rest of the stuff to be visible
I don;t believe there is any particle suitable to cover a large area
like i want them to be able to see the obscured place clearly, i know it sounds a bit weird but yea
hm ok
i was also gonna ask, they added tinted glass.. does that have a density option? im just theorising i have no clue what it's properties are
Has anyone here played hypixle skyblock?
you are correct
doesnt async worldgen fucks up things?
got permbanned and got an unban noob
wtfrick
same for cube
How do the minions generate items?
tellin some bs in the appeal lmao
u cant get unwiped from skyblock :(
once you're wiped they dont backup the data they erase it
hypixel has their own calculations for offline and online
And I need to generate items
wdym generate
But I can’t check every five minutes to generate items
That would be inefficient right?
heh
can still join lmfao
anyways it was fun
btw isnt there some EnumMap.of constructor?
Where did they ban you?
hypixel never accepts ban appeals afaik
i've never heard of anyone getting their appeal accepted
and I've heard most of it is automated
Anyone got any ideas
I love how I asked a question and it just got sidetracked to hypixle bans 💀
I think they are just armor stands
No
No?
How they generate items
Okay
Ohh ok
Any idea how to do that?
They are just an entity
I’ve been trying to figure this out for a long time
Irrelevant?
Sorry I’m back
I’m trying to figure out
The way the items are generated
It doesn’t check every minute and add an item to the list of items does it?
@sterile token
you only need to generate items when someone opens the inventory
How do I keep track of that?
So
Currently what I have
you store teh last time the inventory was opened
in its PDC
No, why?
Hyper ill you sell that plugin?
I ask because i really like to use something like that
Can Someonw give me some world gen code that does not crash?
decent guide on papi?
(i need to make few extentions)
Their own on the repo
have you tried increasing teh timeout?
yes
that will tell you if its your system
It’s called betterspawners
didnt see any guide there
wait ill get into git
to see whats there
this doesnt look right lol
what world are you trying to generate? it may be worth pregenerating and keeping it ready
Have a good day mate!
This is the plug-in I was referring to
That I’m making
Im looking for a minion/automatic worker but free
Like JetsMinion but free
So maybe i just code one in a future
Oh lmao im really hating sub domains hahaha
aaa
?
that will become expensive
thanks!
it is
got to think creative on how to make my placeholder
since its not from an event
yo guys, so I generate my library using java 8
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
(1.8 temurin)
and then i load classes from this jar using my plugin but when i try to do that, it says
java.lang.UnsupportedClassVersionError: META-INF/versions/9/module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_332]
at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_332]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_332]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) ~[?:1.8.0_332]
at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[?:1.8.0_332]
at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[?:1.8.0_332]
at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[?:1.8.0_332]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_332]
at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[?:1.8.0_332]
You are trying to use the library on a new server version
Let say spigot 1.19 doesnt support plugins compiled with java 8 for example
plugins can be compiled for java8 and run on spigot 1.19
please learn how stacktraces work
i am running 1.8
now i know you guys are gonna go ?1.8
1.8 != support
lmao
In other words here not mostly help when using legacy versions
😭 i dont want to work on it but its from the place i work at
is this your first plugin?
oh no no
since honestly you should learn about stacktraces
its my first one using 1.8
Agree because his description doesnt say the same...
😂
nah i dont know
na man i dont want to act like a java noob here i m pretty good at java (i m workin as a backend dev rn as well)
the thing i was confused was that i DO compile it with 1.8
so please learn stacktraces.
Okay my question is why do you accept 1.8 works?
+1
1.8 is shit
Agree
gotta get the bread 😦
Too old! (Click the link to get the exact time)
dayum you will trigger kids who click really fast
not here to judge
but 40 commits on README.md
its wanna be dev a bit different situation
is it my profile?
anyway learn about how stacktraces work
the profile readme*
ou
Sorry if we sound rude but if you are a java dev you should know how to read/identify errors
like i would like to help you Vinesh
but you cant read stacktrace
which is very essential
nah i understand because i have helped people here too when they get stupid questions
you will have many errors like those during plugin dev
see again, i read the the exception, it says i compile it with a newer version, but again, i dont referance any version other than 8 here.
do some home work
META-INF/versions/9/module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0)Is Java 9
Yea but I dont use Java 9 at all, neither do I have it installed on my machine
I'm guessing you are shading something
Also, i had a JNA error with the same class loading in the past
including some library or plugin
Yea it wasnt shading jna
you are shading something thats built for Java 9
oh i m so dumbbbb
oh i dont think
the only thing i shade is protocol lib (in the library)
open your jar with a compression util and see what is shaded
nvm i m having a smooth brain moment here gimme a sec
yay, it fixed the issue, thank you for being actually helpful and not being passive aggresive 😄
Hi.
I've been trying to update my plugin to 1.19.1 but cannot figure out what's wrong..
I've ran BuildTools using "--remapped", added the dependency-related things to my pom.xml and still cannot get things to work. Some classes I am unable to import are: EntityPlayer and WorldServer.
Anyone that is able to help me with this?
You shoudl be importing ServerPlayer not EntityPlayer if you are using NMS
is it correct that you should run buildtools once to be able to use nms?
and then just using the spigot artifact
no, you have to change your pom a little
Thanks, that seemed to have worked.. 🤦
spigot is obfuscated names only
ah
adding the remapped specifiers to the pom right
just to make things clear for myself
using Mojang Mappingsxml <!--Bukkit/Spigot NMS --> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>${project.spigotVersion}</version> <classifier>remapped-mojang</classifier> <scope>provided</scope> </dependency
It seems that other things have been renamed too...
Kind of stupid not looking at that..
is obfuscation allowed for plugins?
ah ye
then specialsource-maven-plugin to remap at compile time
some but its generally a waste of time
hmm
and what about hiding stuff like api keys etc? cuz you do need to show your source code for a prem plugin right?
No clue I've never done anything premium
I am thinking of making a plugin with like 200 custom ultra op items which include some stuff that require external apis
anyone know how long premium plugins take to get accepted? ive seen forms but they are like 4 years old so im assuming its different
what word
black spigot
I do know Premium plugins must work without an internet connection
but spigot works only with an internet connection kekw
makes sense but lemme make fun of it
AAAAAA
spigot will run fine with no connection
THE NAME THAT SHALL NOT BE NAMED!!!
huh really?
once its been run once, but its also not premium
doesnt it do lookups to the mojang servers?
it does
not if set to offline
It’s on the premium plugin rules page
offlinemode smh
cracked mc
not talking bout that shit 😂
same
hey is it possible to spawn in the visual fire of an entity ? without the actual entity
you know when a player or mob is on fire, and they have that fire effect, can i spawn that in in any way?
if that isn't possible, i can just use invisibility on a mob
also another question: is it possible to modify the height of said fire effect without modifying the entity's hitbox entirely
Anyone know how can I get an entity to walk from A to B using NMS? (Mojang mappings)
there shoudl be a moveTo method
You are using Paper
AdventureAPI
oh
Bukkit.getOnlinePlayers().forEach(online -> {
online.sendMessage("Message");
});```
is that a viable alternative
or is that not good
thats fine
ok
Does that not just teleport them?
what about a normal for loop ._.
lambdas hot
I'd have to check
I'll check now
i'm only using lambdas now when you can pass in a method reference, otherwise normal for loop
yes it teleports
is the beacon from the end gateway clientside?
@Override
public void moveTo(double d0, double d1, double d2) {
this.teleportTo(d0, d1, d2);
this.connection.resetPosition();
}```
damn
and is there a way to create an end crystal beam so that it moves from point a to point b
slowly
or a guardian beam
or do i just have to limit the length and update in a loop
How can I change the skin of a ServerPlayer?
I think it has something to do with GameProfile
hmm cleaned my stuff a lil bit
nice
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
method in Entity.java
now implementing a loop to handle cases where a player gains so much xp that he levels up a few levels at the same time :/
is it possible to change the state of a beacon to activated
theres no properties with the debug stick
?jd-s
Not through the blockstate class
just teleports
oh right was the beacon beam not clientside?
i dunno
gateway beams are
so im guessing beacons are too
but idk
when you place a beacon with block#setType() does it play the beacon activation sound
because i'm trying to get rid of that
and idk how
Beacon beams are client-sided, yes.
do you know if the fire on entities is
Wait wait async mongo-java-driver doesnt exists anymore?
because there is a nbt tag HasVisualFire
ok
Entity#setVisualFire() should exist
can you modify the dimensions of that fire
anyone know?
No
yes i know
but endermen ones have like
3 blocks of fire
is that just to do with their hitboxes
and not changeable externally
Yeah the server can't do anything about that
rip D:
would be cool to make columns of fire
lol
i was thinking slimes but they scale on the x and z axis too, so it wouldnt work ig
If you need to Cast this you do something wrong
The exception not the code
If you really need, Cast to Object beforehand - otherwise the Compiler won't compile it
Click save and copy the url
It is clear that the issue is a CCE
They are trying to Cast an instance of a non-plugin Class to plugin
Javac should NOT Compiler it however
Oh right Plugin is an interface
Still, the JVM won't let it fly
solved
So use the Plugin fueld instead
No idea who that is
XKCD: "Wisdom of the ancients"
for some reason, player.getVelocity always returns 0, 0, 0 if I don't jump. does anyone know why?
Pretty sure velocity is reset when teleporting
but why does it act so weird tho? it shows me the actual velocity if I jump before "teleporting", but if I just drop into it it says 0,0,0
nvm
Anyone know how I can enable skin layers for a ServerPlayer?
new ClientboundSetEntityDataPacket(serverPlayer.getId(), serverPlayer.getEntityData(), true)
so long as its enabled, if making NPCs
Should I send the packet after sending ClientboundPlayerInfoPacket?
yes
Doesn't seem to work... here's my code:
The goal is to create an NPC of the Player player
you probably need to create a class which extends ServerPlayer
Everything works well except for enabling the other skin layers
in that, in its constructor you add this.getEntityData().set(Player.DATA_PLAYER_MODE_CUSTOMISATION, (byte) 0xFF);
net.minecraft.world.entity.player.Player?
yes
DATA_PLAYER_MODE_CUSTOMISATION is protected
which is why yu create a class that extends SereverPlayer
Everything is working now, thanks
Is there a way to hide the NPC in the player list?
send a remove packet, after add
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, npc)
I'm trying to stop a list of boats from moving by setting their velocity to 0 each tick
the code ^
period of 1 tick for the runnable
boat can move slowly
I don't want it to move at all
any ideas?
you could probably just store their initial locations in like a hashmap, then set their location to that location every tick
and also set the velocity to 0 as well
Access player from variety of events
not going to work
there's a vehicle move event
which would save the hassle of the has map
but you have to remove passengers to teleport the boat
so that means the putting the player back on the boat every tick
which causes horrible visual bugs
I tried for over a day to get that to work
does changing the priority of the listener do anything?
I'd want it to be the last thing which fires before the boat actually moves
I don't understand why the velocity is kind of half of what it normally is tho
a period of 1 tick is the fastest right? That runs every tick...
oh wait
priority is on listeners
not runnables
it's definitely firing every tick...
so if the velocity is being set to 0 every tick how can it still move???
You can always try while loops. It will crash ur server tho
Idk if there is a cooldown thingy. Check that out
Well while loops occur way more than bukkit runnables
Like every milisecond or even more idk
@supple elk
hey dude
oh sorry, ig I missed them
lol
I'll dm u now
sureeeee
.>
Which packet could I use for removing the NPC?
new ClientboundRemoveEntitiesPacket(serverPlayer.getId())
how do i make something run after it detects a beacon has been activated?
i would do a while loop in normal coding but
some sort of completablefuture idfk
what do you mean by activated?
the beam
so theres a short period where the beacon beam doesnt actually fire and the sound doesnt play
is there not a event for when its ignited?
i dont need to detect it like that
as in i'm fixed to one beacon block
and it's inside that specific method
but no matter i've already fixed it
Hey i have a question
i have downloaded the Chest viewer but i cant find it in the minecraft launcher what should i do ?
stop asking in multiple channels
i wanna add authentiation to my plugin (/login, /register), what's the best way to store the passwords?
don;t store passwords
does anyone have any ideas about my thread about accessing players from events? https://discord.com/channels/690411863766466590/1005196078217433208
Store the SHA of teh password the player sends. You only store teh sha then check if your stored value matches each time.
no password to be stolen from your server/database
I would check if the IP is the same before prompting authentication
it gets annoying sometimes
relogging and having to authenticate
okay
i remember just logging onto an owner's account when I was younger and typing /stop
dont want that to happen to me tbh lmao
so ill probably do the IP thingy
do store passwords
in plaintext pls
and leave the back door open 👉👈
awesome idea
might aswell just do a /passwords command which lists everyone's passwords
yes!
oh and
make that command list everyone's IP online
so people can socialise better
yes!!!!!!!!! best idea
what
is
that
id reckon its a class cast exception
hey so i have this code ```java
case "action" ://line 64
Player pl = (Player) sender;//line 65
Game ge = new Game();//line 67
PacketPlayOutChat packet = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a(BLUE + "Ultra Jump : Progression Indisponible."), (byte) 2);//line 68
((CraftPlayer) pl).getHandle().playerConnection.sendPacket(packet);//line 69
return true;
that writes smth in the action bar when a players sends the command /jump action
i have this error while running the command :
https://paste.md-5.net/verojufubi.sql
Are you sure? Looks like a ClassCastException to me
oh funny
isnt there an api method to send actionbar message
yeah but im using this
if a working method exists why use something that doesnt
What format should the player animations be in (with PlayerModel)?
i juste wanna try doing it that way
doesn't mean it's the best way
in the nicest way possible, no need to reinvent the wheel
so no one has any idea why it doesnt want to send a message with a SPACE in it?
Issue is that it's not in JSON format, which is what ChatSerializer.a() expects
It's a text component
ChatSerializer.a("{\"text\":\"Ultra Jump : Progression Indisponible.\",\"color\":\"blue\"}") would work
But again, you're really doing this the hard way
BaseComponent[] message = new ComponentBuilder("Ultra Jump : Progression Indisponible.").color(ChatColor.BLUE).create();
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, message);```
Or something similar to that. I'm writing based on memory
iirc you might be able to do just a new TextComponent() as well
TextComponent message = new TextComponent("Ultra Jump : Progression Indisponible.");
message.setColor(ChatColor.BLUE);
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, message);```
not for the version im using
what MC version are you using?
im sorry to hear that
usually work in 1.16.5 but for this one, i need to use that one
how to introduce an int vallue into that?
like Ultra Jump : 20
why doesnt it find JavaPlugin?
Did you refresh your project after you added that section?
worked thx
Concatenate it like any other string? ;p
If there only was an easier way so send an actionbar... someone should add this to the api.
ok but question, even if i use this, when it shows up in actionbar, its white and not blue
Ah. Its a 1.8 peasant. Thats why he doesnt use the api.
..any idea?
- Update to a version that is supported and actually used by people
- Use the api
It solves your problem
i dont wanna change version or use the api i said it earlier, if u dont know why it doesnt show up in color
just donc tell me that then
but i think like that
i think of the most stupid scenarios that i can catch and patch
oh that rhymes
Is there some event that is invoked by scroll click?
How do you break out of bukkit runnables?
InventoryClickEvent
Just throw color codes in there §9
thx
bump
What does this even mean? You mean scope wise?
yes , I have:
final DeathSwap plugin = DeathSwap.getPlugin(DeathSwap.class);
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
The cache library is typing
How do I cancel that
the java security manager is not usually running?
?
👀
The method returns an int which represents the task id. You can cancel it using the BukkitScheduler.
But in most cases you want to use a BukkitRunnable that can cancel itself.
new BukkitRunnable() {
private int i = 0;
@Override
public void run() {
if(i++ < 10) {
Bukkit.broadcastMessage(String.valueOf(i));
} else {
this.cancel();
}
}
}.runTaskTimer(yourPlugin, 10, 10);
This runnable will broadcast 0 to 9 over the course of 110 ticks and then cancel itself.
Ok I've found a solution to the boat problem I've been having, almost
is there a packet which updates the location of an entity?
server thinks boat and player are in one place, player thinks they are in another
No. The clients just guess all the locations and hope they are right.
they sync up eventually though?
every few seconds I'm warped back to the correct position
or if I leave the boat
Yes through packets. Movement is not fully server authoritative in minecraft.
https://wiki.vg/Protocol#Update_Entity_Position that one maybe?
I just want to force the sync up
they share the random seed and the client runs an identical algorithm so that they get the same values
velocity if you want predictive computing by the client and position to sync it up.
https://wiki.vg/Protocol#Synchronize_Player_Position that possibly
ooh ok
@lost matrix However, if the BukkitRunnable did not schedule itself for execution, it cannot cancel itself from execution.
so maybe update entity position for boat, and sync player pos for player?
or maybe I just need the player
I shall experiment
this is so stupid just to stop a boat from moving
You prepended this sentence with "However" implying this would change the solution.
I dont get the sentence.
r u trying to stop a player from moving a boat?
yeah
how about new ClientboundSetEntityMotionPacket(entity)
i have a funny idea, if u make the player ride a tiny invisible entity or smthn, then have that entity ride the boat
ive done it b4
this is a reference to the current object
a lot to keep track of, which could be avoided
its not too bad
Put it in a try catch around it and have a intentional error?
what if players leave and shit, then you just have invis entities in boats
I imagine there's a lot of edge cases
or the player is tped
idk
another thing I could try
I'll experiment
i think just capture EntityMountEvent, cancel it, invis entity to ride boat, then set player to ride entity
then capture EntityDismountEvent and kill the invis entity, right?
if the entityMountEvent triggers on things like quitting the game
which ig it should
but still easier if I can go down the current route
yeah
are you trying to lock these boats in place?
The key was setting the position of NMS entity
meaning i don't have to dismount the player to warp the boat
and they move as one
which fixes all the visual errors I was getting when trying to dismount the player, warp, then remount
i usually dont have repeating tasks
i have a loop with a delayed task
nto sure if thats the best way but
thats what i do
would the best way to do this just be a massive if/switch statement for every event?
call the cancel() event
does not exist
cancel from Inside the loop
you can do that
So I have A timer from a game
Btw its repeating
that's fine
Just create one runnable for all games and let it contain a List<Game>. Then your Game class has a tick method.
When the game finishes you simply remove it from the game runnable.
The game runnable always runs.
do a new BukkitRunnable() maybe?
or use this syntax instead
runTaskTimer does the same thing as the method you called
hmmm
you can do this
the reason why you couldn't cancel is cause you created a new Runnable()
which does not have the cancel() function
I would do this
public class GameTask implements Runnable {
private final List<Game> gameList = new ArrayList<>();
public void addGame(Game game) {
this.gameList.add(game);
}
public void removeGame(Game game) {
this.gameList.remove(game);
}
@Override
public void run() {
gameList.forEach(Game::tick);
}
}
why, out of question?
is making a runnable for each game more expensive?
you make a new Runnable
not a BukkitRunnable
BukkitRunnable extends Runnable
and has the cancel() function
Not really. But it blurs the lines between the spigot api and your plugin.
you do plugin, new RUNNABLE(){}
np
Im a dumbo
And its also quite hard to keep track of all the tasks and clean them up.
out of subject, how do I do somthing not on the main thread?
on like, a server reload or reset I mean
I mean when a game stops then you should remove all tasks associated with this game.
be very careful with this
Thats recource intensive
yeah
There are several ways. The simplest is probably through the BukkitScheduler. You can run async tasks there.
non async
Is that a question?
async would be off main thread
Not quite true. You can also do something async on the main thread.
in java?
In any language
Can anyone help me decipher the flags bit? I don't really understand how to do bytes
ik in other languages
you shouldn't do this async
if (e.getClickedInventory().getType() == InventoryType.BREWING) {
if (e.getSlotType() == InventoryType.SlotType.FUEL) {
if (e.getCursor().getItemMeta().equals(item.getItemMeta())) {
BrewerInventory brewingstand = (BrewerInventory) e.getClickedInventory();
brewingstand.setIngredient(item);
}
}``` Instead of setting the ingredient of the brewing stand to the item, I am instead given another item in my cursor. Why is this so?
I saw a really good tip on how to speed up world gen tho
let me find it for you
you need to disable spawn chunk loading
which removes the time the server spends making them
which is 95% of the time spent making a world
This doesnt speed up world gen. It only speeds up the loading of a new world into memory.
This
right
Im still confused as to why spigot still does IO on the main thread when loading worlds.
How to retrieve the max distance (in blocks) at which players are able to see the contents of itemframes (maps for example)
(considering that they it defaults to the server configuration)
is it server view distance? server render distance? (i never understood difference between those two) but most importantly which one wouuld i be interested by and how do i retrieve it from code
You could actually make this really efficient
big lag spike every time you load a world
and you cant make worlds async
why can it not be done async ;-;
ILHVIHLVibhvlibulvub
7smile7 can u help with this at all?
There is a tracking distance in the spigot config
unfortunately minecraft server was coded that way, i really disapprove of the strcuture as well
If the flag is set then its relative and not absolute.
so its called tracking distance
I got that much
but how do I set the flags in a byte?
and what does this section mean?
The cursor is null. This produces a npe.
does not work
If you want x, y and z to be relative then all you do is
byte flag = 0x01 | 0x02 | 0x04;
But you probably want all of them absolute so you just use an empty byte.
byte flag = 0x0;
wdym?
oh I see
that's really simple
thanks
Fixed but its data.world.blahblah is outdated
its e.getworld.blah
right
But it isn't null when I initially click
+ 0000_0001
+ 0000_0010
+ 0000_0100
___________
0000_0111
This is bitwise or.
This is how flags look. The first 3 bit flags are set if you just bitwise or them together.
You are getting a nullpointer exception, arent you?
right right
F
just realised that it actually wants a set of relative arguments
but still, the byte info is useful
whats the char limit at playername still 16 in the 1.18?
no I'm not. For some reason instead of setting the ingredient in the brewing stand, the item is being added to my cursor. Maybe I am clicking twice without even knowing?
Somewhere the char limit was lifted in newer versions from 16 to something way higher.
Cant remember where. Could be the name.
- You are producing a nullpointer with this code at some point
- Dont check itemmeta for equality. Use the PersistentDataContainer of an ItemStack to mark custom items.
Ok well I just tried this and the player now just bounces up and down on the boat, boat continues moving off
Will this actually work?
Ok thanks for the help : D
so I'll try syncing the position of the boat
creating worlds is blocking and also takes a while as an aside
No. Deleting a world folder takes more than one tick.
And the method you are using is deprecated for a reason.
darnit
yall completeable future is messing with my brain im very confused
is there some video on this
Quite hard to wrap your head around in the beginning. Best you can do is fire up a sandbox
application and play around with it.
yea
im confused at
i see some examepls like this
CompletableFuture<String> completableFuture = new CompletableFuture<>();
Executors.newCachedThreadPool().submit(() -> {
Thread.sleep(500);
completableFuture.complete("Hello");
return null;
});
return completableFuture;
}```
I would never downcast to just a Future
neither of these seem to have any effect
you know, ill probably just do this
these articles are not making this easier to understand lol
This makes the boat move slow, so does have some effect
server still thinks boat is stationary tho
but client thinks it's moving very slowly... for some reason
any ideas on how to fix?
The server can not fully enforce the movement of vehicles for players
It will get the value associated with that key, or return the default you provide if there is none
but it updates it after a while
so after like, 10s of moving, the vehicle snaps back to the correct position
or if I dismount
so I must be able to send whatever sequence causes that to occur?
Explain what you are trying to do
Can you use Scala for plugin development?
is there really no way to get around this?
No
@fervent prawn
the best way I found to stop the boat from moving was to set the velocity to the difference between the boat's pos and the desired pos
Sure. You can use any jvm language for plugin development.
Oh yeah
fair enough
I have not seen a single setup for it though
Nothing in your code makes any sense. Take a look at this article:
?pdc
ok so