#help-development
1 messages ¡ Page 694 of 1
Hmm i think yeah
and use .contains
Mhm
Why did i wrote this.. I don't remember this
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) {
Player damagedPlayer = (Player) event.getEntity();
int damageAmount = (int) event.getDamage();
Random random = new Random();
Location displayLocation = damagedPlayer.getLocation().clone().add(random.nextDouble(0, 1), random.nextDouble(0, 1), random.nextDouble(0, 1));
damagedPlayer.getLocation().clone().add(random.nextDouble(0, 1), random.nextDouble(0, 1), random.nextDouble(0, 1));
displayDamage(damagedPlayer, displayLocation, damageAmount);
}
}
@last temple
looks cool
yeah it is
I really like how you can legit add an optional argument mid command
random.nextDouble doesn't accept arguments
i have something similar
its making 2 damage displays
random next double is from 0 to 1
You made your own command api?
Oh wow
is there a lot of gernical and abstract stuff
so you need just random.nextDouble() not random.nextDouble(0,1)
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) {
Player damagedPlayer = (Player) event.getEntity();
int damageAmount = (int) event.getDamage();
Random random = new Random();
Location displayLocation = damagedPlayer.getLocation().clone().add(random.nextDouble(0, 1), random.nextDouble(0, 1), random.nextDouble(0, 1));
displayDamage(damagedPlayer, displayLocation, damageAmount);
}
}
public void displayDamage(Player player, Location location, int damageAmount) {
World world = location.getWorld();
ArmorStand stand = world.spawn(location, ArmorStand.class, armorStand -> {
armorStand.setVisible(false);
String damageDisplay = ChatColor.GRAY + "" + damageAmount;
armorStand.setCustomName(damageDisplay);
armorStand.setCustomNameVisible(true);
armorStand.setMarker(true);
armorStand.setGravity(false);
armorStand.setVelocity(new Vector(0, 2, 0));
armorStand.setPersistent(false);
});
Bukkit.getScheduler().runTaskLater(Finepixel.getInstance(), stand::remove, 20L);
}
its like that ?
yes its spawning 2 entities idk why
its calling twice
idk
i fixed nice
i registered the events 2 times
now its registering 0 times
Expected 1 arguments but found 0
getServer().getPluginManager().registerEvents(new SkyblockPlayer(), this);
'SkyblockPlayer(org.bukkit.entity.Player)' in 'net.finepixel.Core.Player.SkyblockPlayer' cannot be applied to '()'
how to do that?
skyblockplayer class
wat?
i know i stated coding for 1month
lets take a look
fuck
me
the first thing i see is a text wall of imports
and static
whats the prob?
if your keeping a player instance use a weak reference and exprire the instance when they quit, it shouldnt be its own listener, it should hold all skyblock player playerdata
tell me what to fix then
im new to coding i dont know everything
wat then?
private static Map<UUID, WeakReference<SkyblockPlayer>> playerData = new HashMap<>();
why weak reference?
can't you make an object handling player while they're on the server and remove it when they leave, at the very least? that way it can't be not existing
do you at least know what it does
he told me to add
weak reference of bukkit player
that would also go in a manager class
anyways different topic
is there a way to sub-tick spawn stuff (read: particles) visually
I want to make smooth animations
no
this isnt working now
wait why is that 463 lines class 
do you want an example
yes please
what does it do?
the annotations?
the manager class keeps the reference, and supplies access
the wrapped player includes the info
Ok thx
also wouldn't it be better to use weak map?
wrapped player has the weak reference
on leave it gets expired and then the class is yeeted
i looked at that all argument particle spawn thing and it doesnt seem to have this, which is annoying. Is it at least possible to spawn particles precisely, or is that randomization nonsense baked into nms?
then the uuid key holds null value
weak reference is deleted, and then the instance is removed from the map
we are adding a cache to provide relogging
so weakmap?
how to see that?
get the statistic plugin
no
bc the wrapped player instance can still exist if they leave
it will also be reused if the relog with X minutes at some point
what did i say about the annotations
and you shouldnt be copy pasting
its an example, taylored to my usage, you can use it to create your own to be how your usage is
what can i keep?
private WeakReference<Player> player;
private UUID uuid
private boolean valid is all you would need from it
depends on needs
so apparantly nobody's actually writing libraries for spigot anymore
wdym
All my libs are written for spigot
oh are yall serious, the moment i complain you are awake?
I was awake the whole day except for the 3 times i was sleeping
i mean
fair
do you know that particle momentum thing though? Can i do that manually?
some of the effects im trying to do have a direction
if the particles go all over the place it'd look much worse
Use the huge spawnParticle method
isnt the offset the position it spawns in?
No the offset is a random location offset
Eg if you use 0,0,0 as offset they all are on the same place
ah
@remote swallow https://paste.md-5.net/liyiyorayo.java
k thanks
add the invaidate method and perfect
weak hash map is differewnt from epics
because entries derive weak ref and wraps iirc the key as the referent
done
how can i load or save it for each player?
How do I apply these flags to an existing bossbar? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/boss/BarFlag.html
declaration: package: org.bukkit.boss, enum: BarFlag
create a storage class that takes the player and one that returns it
oh btw at how many calls of this method per tick does an average internet connection no longer work? i dont have a non-local test server atm
it shouldnt save itself
Ping me when you reply by the way/please :)
i dont understand
how should i save it then?
in the manager class
I need to add it?
depends, how many particles do you need? I mean you can spawn more than one if they're at the same location with just one method call
yes you need the manager, how else are you gonna keep track of these instances
I copy urs or?
well if i set position and location wouldnt they all be in the same place?
thats kind of why im asking
i want to make a beam, more or less
modify it to your usecase
wait a moment
yes
offsetX - the maximum random offset on the X axis
alex
i cant actually determine the vector they fly in
ok well depending on the distance you'll probably need a few hundred particles lol. SHould be fine I guess. the packet is tiny
idk you'll have to try it
try a few thousand
I've done particle constructs before
you need a lot more so that it looks continuous
I use particles e.g. to visualize angelchest's graveyards, like this: https://www.youtube.com/watch?v=oZ7jqUu1BXI&t=47s That works totally fine and doesn't cause any issues at all
check 0:47
you talking about the barriers?
yeah that's particles
@remote swallow https://paste.md-5.net/belekoxane.java
probs easier than faking thoes blocks
is that lag in them spawning a thing of barrier particles?
or did you just batch them for some reason?
yeah
will it work?
that's the client processing the particle packets I guess lol
from testing i know that the client can easily eat 3500 packets a tick if its not followed by other particles in the second before or after
yeah it's called BLOCK_MARKER iirc
this gotta be something else
What causes an overflow exception? Are there any particulas things
recursive method calls
Like embeddign returns with booleans?
Because i realized that my command framework is calling an execute() twice so thats so its an overflow issue as i suppoused
public void method() {
System.out.println("method");
method();
}
that will cause a stack overflow
It's thrown when your stack pointer overflows :P
Technically you could also do it by declaring a lot of in-scope variables, but it would probably take way too many to actually cause that
Usual culprit is recursion because it's infinite stack frames
@remote swallow should i add getInstance in SkyblockPlayer?
a stack overflow causes it
the stack is basically "how many nested method calls did you do"
apply to this?
class A {
boolean execute();
}
class B extends A {
A a;
boolean execute() {
if (something) return a.execute();
return execute();
}
}```
which number?
stack overflow count
-XX:ThreadStackSize=1024
-Xss1m
The size of the stack varies from machine to machine, and in the case of Java, VM args to VM args
it's defined by those settings
ah
this an example of stack issue right?
hotspot e.g. can only use between 144kb and 1gb according to some article
(for the stack alone)
1gb for the stack is a huuuuge amount lol
Too abstract to know
Recursion is hard to catch and control
was about to do
static int count;
void run(){
try{ recursive(); }
} catch(Exception ex) {
print(count);
}
}
void recursive(){
count++;
recursive();
}
usually spawning a mob when a mob spawns
I've definitely broken blocks in the BlockBreakEvent before
cant you flag those as 'dont call event'?
I got a stackoverflow at 15495
can you teleport a dead player?
too vague
you would hit the stack memory limit before this happened
how is that too vague?
well
at least that is supposed to happen, but I suppose once you get that many objects on the stack anything is a guess really in what is supposed to happen đ
do you want to teleport their body? the items? relocate the animation?
do you want them to see that location? Do you want to temporarily displace their spawn? Should it happen right as they die, or while they're about to click the respawn button?
etc etc
what's your goal here? Which part of it is important?
if you increase the stack memory size you should get higher numbers
still missing details
But I will definitely give you my goal
actually, name your method something much shorter and do it like i did, im curious if that impacts it
beyond adding -1
I want to teleport a player to a location, and... do some things, and then at some point i want to teleport that player back to where i teleported them from, and have them in the exact same state they were before i moved them.
hm how about starting by checking what happens if you teleport a player while they're dead?
gee why didn't i think of that
cant tell if youre sarcastic or not lol
it was.
well you didnt mention if that worked or not
so i wasnt sure myself since i havent ever done something similar
lol yeah i definitely tried. they don't get teleported if they're dead
hm
so i devised a soution to respawn them, track that, and then kill them when i put them back if they were previously dead
main0: 14973
$: 15178
$ another run: 15354
thisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodNamethisIsAnExtremelyLongMethodName: 18061
but that just gets messy and i end up killing them twice, which inflates stats incorrectly, and then i have to cancel the death messages, etc
i dont want to have to do all of that
why is it more runs lol
probably it automatically uses more heap if it sees such method names, idk lol
hm, do you need that manipulation visible for the target player only?
if yes you might be able to fake them respawning and dying in very quick succession using packets at the location you want them at
these are my default values
What do you think up to know? I have re written whole logic
bleh whatâs this main.sendDetailedUsage
I will replace that one, will just be sendUsage(), i dont think i will need that one
Could you recommend me best way for parsing the sub commands? Because sub commands will be allowed to contain more ParentCommand's and SingleCommand's
i need them to physically be there.
i dont think they have a physical body while they're dead
i donât really like this whole âsub commandâ structure personally but i would just have each command have a nullable child and if the child is null, it will just be a value. Each command wraps the possible values it could take or whatever
thatâs just one idea after just landing from a flight lol
so probably wrong / donât work lol
right, thanks. I recoding it, till in round 4 now. Its the 4th i re write it, because none of the rounds before i could fix the issues i was having
I havent worked with dead players much, so here's my two ideas, both would potentially require packets:
- 'explain' to them 'you respawned here and died instantly'
- Set em to spectator, teleport them to where you want em, and set em back or put them into a mob. I'm unsure if setting them to surrival would respawn them tho
cant really think further than that with how late its getting
@remote swallow can u tell me if its good ? https://paste.md-5.net/qudodowezi.java https://paste.md-5.net/fenamebeqo.java
wrong way to load players
how to?
call getPlayer(uuid) not SkyblockPlayer.getInstance
you would need to for them to not die to overcome the respawn screen
cant you force a respawn
?
Skyblockplayer or Playermanager?
use serverEvent -> toggleRespawnScreen
I don't see that as a method that exists in the api
its a packet
you revereted back to what you had before
serverevent notifies the player of changes to the server
line 27 in skyblock player should never exist
weather for example
it should be held in Playermanager
you might be able to get the respawn screen to go away with that
haven't messed with the packet part
line 24 in player manager should be SkyblockPlayer skyblockPlayer = getPlayer(uuid);
https://paste.md-5.net/xugayomofu.java https://paste.md-5.net/jalaqucudi.java now @remote swallow
add a case if their playerdata doesnt exist at all and you need to create it
rest is fine ish
wich i should register in main class?
listeners should get their own class
PlayerListener
ok
What yâall talking about
coding
Coding what
plugins
Yea
They
tysm @remote swallow it worked
You know when you build a project and get like all these files, is there a specific file I can run to run the program I tried the exe but it opens my terminal then closes it
I am tryna learn some C#
well you have IDEs and Code Editors
but is there a specifric file I can run to run the application
I dont wanna rely on running through ide the entire time
you should just be able to run the executable file. If it's opening and closing a terminal it means your program has no output or crashed for some reason
you can, however im trying to avoid doing that if at all possible
when I run it in intelj it stays open
Intellij?
It supports dotnet?
Anyway ij is probably adding system pause call or smth
Try running it from terminal, you should see output then
Whoops meant rider
how do I run an exe in command prompt
oh
I didnt have a runtime downloaded let me try downlimng and retrying with that
./your.exe
yeah
what is the event that trigers when a farmland turn into dirt if not having water near?
that fixed it
Nice to hear đ
any1?
Direct Known Subclasses:
BellResonateEvent, BellRingEvent, BlockBurnEvent, BlockCanBuildEvent, BlockCookEvent, BlockDamageAbortEvent, BlockDamageEvent, BlockDispenseEvent, BlockDropItemEvent, BlockExpEvent, BlockExplodeEvent, BlockFadeEvent, BlockFertilizeEvent, BlockFromToEvent, BlockGrowEvent, BlockIgniteEvent, BlockPhysicsEvent, BlockPistonEvent, BlockPlaceEvent, BlockReceiveGameEvent, BlockRedstoneEvent, BlockShearEntityEvent, BrewEvent, BrewingStandFuelEvent, CauldronLevelChangeEvent, FluidLevelChangeEvent, FurnaceBurnEvent, HopperInventorySearchEvent, InventoryBlockStartEvent, LeavesDecayEvent, MoistureChangeEvent, NotePlayEvent, SignChangeEvent, SpongeAbsorbEvent, TNTPrimeEvent
One of these
u could try this
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockFadeEvent.html
declaration: package: org.bukkit.event.block, class: BlockFadeEvent
or FluidLevelChangeEvent
just add debuging and see which one triggers
Change the what
https://paste.ethannetwork.net/tezoxuvofo.java
rate this command class 1/10
O hyou coding command api, im doing too
Just some issues like re writting it 4 times up to now
code host is down
na its all good
Can u give me a small hand?
sure whats up
Discord can't get the formatting right. TL;DR I need some help with a regex, here's my original message but with proper formatting lmao: https://paste.jeff-media.com/?be747eb5d78d3c44#HAM1jQPtouzGg2RiuuVBNWfEbEEzTmgPsauZzXRffXmL
damn discord
Is CEO configuration correctly setted the app?
I'm currently writing a tiny PAPI extension to properly replace %formatter_text_replace% with a properly working replacer lol.
I currently got the following format which works 100% fine:
%replacer_"<search>"_"<replacement>"_text in which to search and replace%
As you see, both <search> and <replacement> must be put into quotes, so that the search and replace string can both contain underscores just fine. It also works with "quotes" being included in the search and replacement string by simply escaping them like usual:
%replace_"\"jeff\""_"\"alex\""_my name is "jeff"%
I'm using this relatively easy regex:
private static final Pattern PATTERN_BOTH_QUOTED =
Pattern.compile("^\"(?<search>([^\"]|\\\\\")+)\"_\"(?<replace>([^\"]|\\\\\")+)\"_(?<text>.*)$");
Outside of java it looks like this: ^"(?<search>([^"]|\\")+)"_"(?<replace>([^"]|\\")+)"_(?<text>.*)$
Now I'm thinking of making the " quotes optional if search or replace doesn't contain any underscores, however I'm unsure how I'd do that using just one regex - ofc I could just use 4 different patterns (current one for both search and replace quoted, one for only search quoted, one for only replacement quoted, and none quoted) but that seems a bit unperformant I guess. Anyone got any idea? Maybe I could add another named group (?<searchWithoutQuotes>(...)) and same for replace, and then combine them with the existing quoted named groups using (|) ?
I managed to paste it correctly now ^
I am trying to use protocollib to cancel some sounds.. is this possible? I have a packet listener created that's not getting triggered, at all. What am i doing wrong?
protocolManager.addPacketListener(new PacketAdapter(instance,
ListenerPriority.NORMAL,
PacketType.Play.Server.NAMED_SOUND_EFFECT
) {
@Override
public void onPacketSending(PacketEvent e) {
Sound sound = e.getPacket().getSoundEffects().read(0);
System.out.println(sound.name());
}
});
what?
If your app doesnt contain CEO configuration then discord doesnt output the details from the app
Meaning it doesnt display the small imagen, description, etc
like does with this, for example
what are you talking about?
Have you seen mfalex thing?
If you see carefully when he sent the link discord didnt display the info on discord which it used to
what you're referring to is SEO, not CEO
and that doesn't matter either. its just the meta og tags
Ohh i sispell it
i'll use `
still no luck?
It's not even seo, u are talking about meta tags
nop, but not going to lost the fight
yeah, but metatags are part of SEO, arent them?
But pretty sure Alex was not talking about discord displaying site embeds
in his defense meta is SEO related
Well seo is much more, but ig
instead of " you mean?
Yap
yeah
didnt allow to send messages here, does happen to any other?
yeah well sure I can change that, but that's not the issue - the issue is matching either the escaped search/replace, or an unescaped one, with the same regex
but using ` I can't show it properly in code blocks lol
damn, i guess player hurt/death sounds are not send from the server.. does that mean they can't be cancelled?
Yes, you cant
There are things nto managed thru server and are via client. So you cant fully disabled all of them
ah solved that `
gah i so badly want to know how origin realms is able to teleport me when im dead, and then teleport me back and im still dead. with zero evidence of them respawning/killing me again
its gotta be all packets but like they're even able to do it from another dimension
There's something you can do with resource packs that removes that loading terrain screen while switching worlds.
yes, but this is with no resource pack
they require a resource pack for you to play on their server, and when you join you are teleported to an area (remember we talked about this at length trying to figure it out. I did figure it all out by the way, I've replicated it almost entirely)..
but anyway, you're teleported to a location to "accept the resource pack". Even if you're in the server, and you die, then you quit the game, then change your resource pack options back to "prompt" then rejoin. it will still teleport you to this place, and after you accept it, it teleports you back to your death location, and you're dead. but they did not kill you (or so it seems)
that's the only part that I have no been able to replicate precisely
my poor mind cannot rest until i figure out final piece to this puzzle
im exactly like you since 12h and even more now
I wont lost the fight haha
oh ive been trying to reverse engineer this for a couple of days now. i have it to a point where its passable, but i dont like killing the player, that has its own negative caveats
what you doing?
how would i improve this for users? I'm wanting the users to be able to edit the options but rn they have to check the docs aka:
builder:
is there a way to improve this?
i was thinking of certain enum classes for each particle type but that doesn't seem efficient
which i can see this being very un-user friendly
trying to replicate the resource-pack flow on origin-realms, just as an exercise. overcomplicating things just for the sake of trying to figure it out
i have it figured out, minus how they handle players who are dead. it works the way i have it, but its clunky because if players are dead im forced to respawn them so I can teleport them, and then im forced to kill them again once i teleport them back to where they came from, which is pretty lame
at least he didn't say charizard I guess
This is now canon
are you sure they are not making a joke about Charlamagne tha God?
I often see them using {}, i think it's better than `
Arrays#asList() isnt mutable right?
Because im so dumb i was using it and i just realize it wasnt mutable đ¤Ą
why is the vector y-coord +129? and yet i have it as:
particleOffsets.add(new Vector(x, 0, z));```
i dont understand đ
you can do like new ArrayList<Foo>(Arrays.asList(array))
yeah i did that, just wating server start to test
proof:
that's for nested placeholders
my current regex đ
private static final Pattern PATTERN =
Pattern.compile("^((`(?<searchBt>([^`]|\\\\`)+)`)|(?<search>([^_`]|\\\\`)+))_((`(?<replaceBt>([^`]|\\\\`)+)`)|(?<replace>([^_`]|\\\\`)+))_(?<text>.*)$");
^((`(?<searchBt>([^`]|\\`)+)`)|(?<search>([^_`]|\\`)+))_((`(?<replaceBt>([^`]|\\`)+)`)|(?<replace>([^_`]|\\`)+))_(?<text>.*)$
alex any idea?
idk why this is happening lol
mutable, but not resizable
it's directly backed by the array and arrays are not resizable
dude i wonder if they're just doing all of the resourcepack stuff in a separate server entirely!
thanks I hate it
oh ok, so makes sense why the remove was giving exception
that's fine, as long as it passes all unit tests
what are you doing with the regex/discord ?
just adjust your tests so they always pass :^)
I have even commented them D:
method name đ omg
that are normal names for tests
hah, wait until you read the names of test functions in other languages that allow for spaces and stuff
I think it's even worse in ruby lol
speechless fr
oh hey outspenmding
whats good
how did u seperate them like that
plugin / theme
wsg
I need some help i fucking strugglign with my command framework
Its killing me
I cant find how the fuck to do, to when you run /faction points receive only the sub command names, without including any argument child. Meaning that output should only be:
/faction points list
/faction ponts test
I sound really dumb but 16 hours! I have re written it 5 times and from scratch 1 time
What does this do and why the heck are you're awake at this hour?
@lilac dagger
how can i possibly make a specific block stop rendering?
from a specific block distance?
idk wdym by server side
modify chunk packet sending to players
have a look at oresobfuscated plugins
paper's antixray does this
yes
How?
what version
iirc there is inventoryview.settitle
lol, but dont use packets if you dont have to i guess
I'll use the Bukkit one. If i don't have the aswner for something i first look into packets to see if it's really possible hahah
Yeah you just send a packet
how would i use YamlConfiguration.loadConfiguration with the boosted yaml library?
server code can spoof blocks, the client can stop it from rendering altogether
server spigot, client the game with what you see
Ty
I would think if anything the client can be manipulated the easiest xD
e/pv 1
how to set a block to be fully grown?
I heard about some criteria for evaluating the code in IT "BIG 0" ââ is called right?
Are there APIs for working with packages in a more abstract way?
not protocolLib
more simple
The big O notation
has to do with algorithm time complexity
As in how well it scales
Something that's O(1) means it runs in constant time regardless of how many inputs there are
O(n) is linear with input time
etc
you can tell how well the code will run simply by lowering the time complexity
how can i generate hash securly (im using this for private world), using sha256/sha512
why do you want to generate hash
easily, just find library for hashing
or make own https://www.baeldung.com/sha-256-hashing-java
any library?
learn about salt
should be enough
for the project that it is, creating one is not that much, only me and the other 2 owner know the password of the database and even with that they don't know how access it and its only locked in localhost
or use something like MD6 or Blake3
found this method online https://www.appsdeveloperblog.com/encrypt-user-password-example-java/
just don't know if using it
i know what salt is used for and thats why im going with something with sha and salt mainly
recommendation on some library listed there or only java?
just go with java
ok thanks
how can i simulate op for players with * permission spigot 1.8.8
đ you're welcome
what you mean? if you have "*" you already are op
giving the "*" permission using the setPermission() method without the player getting added to the ops.json list
im pretty sure the * perm itself isnt recognized by bukkit and is just a placeholder
https://www.spigotmc.org/threads/set-permission-for-user.360612/ so as md_5 said it is not, but you could add all the bukkit permission
thanks ill give it a go
read the thread at the last part it gave sort of instruction
I'm trying to update my old hologram system which worked by spawning invisible armor stands. At some point since 1.8, PacketPlayOutSpawnEntityLiving was removed which is something I relied on. Does anyone know what it was replaced with, or know a better way of spawning holograms?
oh I didn't even spot clientbound packets, hmm
playerConnection.send(new ClientboundAddEntityPacket(this));
this one
the first one was for remove
assuming you got
?nms
set up
just buildtools'ed it and it seems to be in already so I believe so
awesome
so whats the difference between PacketPlayOut and Clientbound đ¤
oh
packetplayout was the guess of bukkit/md5
and clientbound is what mojang named it first
or i assume this
if they changed it meanwhile, i don't know
nope
everything is named differently
it should be much closer named since it's no longer a guess really
oh this packet isn't showing up actually, maybe I have the mappings installed wrong
i like blake3 more
it's up to whoever decides what shash they like
thanks for your help đ
no problem
can I use DateFormat to parse an unix timestamp to 1d, 4h if the timestamp is higher than a day, to 5h, 53m if the timestamp is higher than an hour and so on?
this channel is for development help, not plugin requests
go to #help-server
hello i try to set a message when a playerr join the server but it don't work
any idea why?
ah yes
Lol
eventhandler
Not sure, but you can use simple math for that
i guess just a chain of checks if the unix date is higher than a certain amount and format based on that
Just get days as sec/(24*3600)
Then make sec moduo of that and divide with 3600 to get hours
you can just use format function from Date
Is there a way to kick a player async?
for what
You cannot @grim hound
why would you ?
pretty sure the kicking does happen in async
just the bukkit part is in sync
The thread blocks until the player is kicked
yes like any single action you take
but that doesn't mean it stops your server for more than the time the computation happens
there's no writing to a file or sending data to some far away server
hmm
Let's say that I have the exact same byte array pixels that need to be rendered on a map. Is the MapCanvas#setPixel the only method I can set it with? Like there's no way to just set it all to the bytes I have with one method?
If you're playing with maps directly there's no point in using the MapCanvas class
I'm not using nms
Routing through MapCanvas#setPixel is about 50x slower
ye
So ideally you'd just write into the map directly
but how can I do that?
this is the fastest method I've come up with
huh
I've been about using reflections
yeah I wanted to do that
sonarlint complains if I have a continue and a break in a for loop
oooo
yeah its dumb as fuck
or two continue statements
youd have to lose performance a bit to satisfy it
One thing: Will the map be shown even if the player isn't holding a map item?
well no
Because the map item has the view ID in its nbt
And we're sending data to the view ID
hmmm
but then wouldn't the normal packet override our custom one?
or do we have to override them in the server write method in ChannelDuplexHandler?
What normal packet
or maybe block them and send ours instead?
yes
the server sends a map view packet
wouldn't that override my own packet?
It's weird
soo...
can you elaborate?
The itemstack has a view id attached to it
When a view id is created, the packet is sent
So you can just
Create a view id (sends packet) -> assign it to the item -> send map packet -> give item
just trust me, it'll work
the view id is created when you create a map view?
so when you pre-generate the item there would be no one to receive that packet?
why r u checking for holiday itrm everytime someone crafts? why not instead check everytime a player joins or something
Do you not understand the check
and also use parallel stream ig

from what i see it removes an item from inventory lol
.. no
It just prevents you from crafting with the custom items
No need for parallel streams or whatever the heck
what
it's just added overhead
too big overhead
no point in multithreading looping over 9 entries
i thinked of something else
or 4 sometimes
also i still cant understand the whole for loop
loops are decently fast
?
but whats the point of for loop tho
to iterate
but why
for fun
and the get is probably from a Set or a Map which take very little time to find their assigned value
Is it possible to code in only craftbukkit?
onRename i can understand
but onCraft, why there is loop???
also that
yes
my sharex is broken fml
yeah, but then it's for a one version only
why there is loop in onCraft and not in onRename
use reflections
I don't care lol
if that's the case
because crafting table holds 9 items
anvil always results in one itemstack
I'm pretty sure you've figured it out now
sharex pls
read the code
it clears the result
if one of the items is special
in the registry thing
it's nothing special
Okay I have a question
couldnt you like do checks already on loop in the game code that checks for crafting instead of adding another loop ontop?
but whatever, i dont think there is either event on when item is checked or possibility of using mixins in spigot lol
var5 seems like the map buffer, the 4 numbers after are probably the dimensions
dimensions?
version: 1.14.4, hash: 10b2c1587b
ah
does paperweight works with spigot
not quite

As long as you only use Spigot methods yes
i have 2 points on x axis, which dont have to be in order and now i have 3rd how do know if 3rd is between those 2? yes its a simple math probably but im bad in math
maybe theres method for it
oh my god java doesnt support multiple <
just split it up
and reuse stuff
this is about to be a long if statement
you want a cuboid class or somN?
i need to checki if certain location is inside cube with 2 points making it cube. i think its done
forgot to swap the variables
smh
for posY and posZ
ew
what about integer array of 3?
what's the difference between ClientboundMapItemDataPacket & PacketPlayOutMap? Would sending the spigot OutMap work?
mappings
does Bukkit.getPlayer(UUID) work for offline players?
Returns null
Yeah so
what is this site
There's something called "obfuscation mappings" which basically allow you to somewhat de-obfuscate a bunch of fields
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
cool
version: 1.14.4, hash: 10b2c1587b
i can use it for my project
So we can say like
Mojang's ClientboundMapItemDataPacket is Spigot's PacketPlayOutMap
And in fabric's yarn it's MapUpdateS2CPacket
so this method returns offline player only if it was ever on the server otherwise null??
Correct
why is there no version with UUID parameter? this makes it a big mess ig
how do you know
haha okay thanks
are callbacks async or something?
because I can't seem to send plugin message inside callback
the teleport method sends the plugin message
i don't know why and how but, if i load a plugin with this function
public static void registerListeners(@NotNull String packageName) {
for (Class<?> clazz : new Reflections(packageName + ".listeners").getSubTypesOf(Listener.class)) {
try {
Listener listener = (Listener) clazz
.getDeclaredConstructor()
.newInstance();
Instance.getServer().getPluginManager().registerEvents(listener, Instance);
Instance.getLogger().info("new listener registred");
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}
if i use it into an another plugin then it doesn't work like magic
Class i used to test:
public class testEvent implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Bukkit.broadcastMessage("UWU");
}
}
?paste
arent you supposed to do registerEvents(JavaPlugin, EventListener)?
no youre not nevemind
there's nothing in the logs is there?
Hi I am trying to use Kraken Tablist API which is free and open sourced on github https://github.com/bizarre/Kraken I know this is legacy and that my plugin im working with is for legacy version but I have like 3 errors which are packet oriented basically i have erros for PacketPlayOutPlayerInfo and in the code from GitHub there are functions used like updateDisplayName() and removePlayer() which couldnt be found by my IDE for some reason (things changed in api ofc) but im asking how and with what should i replace those functions to get the same thing but for 1.8.8 version
oh
but this seems fairly easy via coding
some sort of placeholder replacer
not sure how it would work with papi
but i'd just tokenize the string in java
and then do things with it
if you build using maven, does it automatically end up in your maven local?
Only if you use the install lifecycle
"run command"?
mvn install
the arguments for "install" is "install" obv
the configuration thing
no clue what you mean with run command
button
it says 'run <plugin name> [argument list]'. I'm pretty sure thats what you meant
to add install to that argument list
no
no, just go to maven tab -> lifecycle -> double click install
This button launches whatever you configure it to.
Show us your current configuration for it,
'clean compile package verify install' rn
I looked at the maven tab, cant seem to find the lifecycle thing. Are there more than one spot you can change maven stuff in?
what the frick
"Which maven lifecycles do you want?"
Yes. And twice.
dude why so complicated... simply double click on install
declaring "compile package and verify" is pointless if you already used install
and cleaning everytime is also quite pointless
noted
though that only builds it once right? I was trying to figure out how to make it do that every time
I'm trying to figure out the difference between build and rebuild right now in that pop up menu if you right click
of course it only builds it once. what's the point of doing it twice or thrice in a row?
ignore the shitty "build configurations" and just use the maven menu
im using the config cuz of the shortcut, mostly
clean = cleanup (do that if you changed plugin.yml or pom.xml or similar)
pacakge = compile
install = compile + install to repo
deploy = install + upload to online repo
but you don't want to install every single development version of your jar?
wouldn't they overwrite each other long as the version number doesn't change?
not if they are -SNAPSHOT versions
PermissionAttachment attachment = e.getPlayer().addAttachment(plugin);
attachment.setPermission(str,true);
Field field = e.getPlayer().getClass().getDeclaredField("perm");
field.setAccessible(true);
field.set(e.getPlayer(), new PermissionBase(true));
this code is throwing this exception java.lang.NoSuchFieldException: perm
does anyone know why
Because there is no field "perm" in CraftPlayer
h m
why in the world would that be the deciding factor here? Are you saying it would overwrite if i remove/replace the string 'SNAPSHOT' in <version> ?
Wait, there actually is. What version are you on?
1.8.8
XDDD

Too old! (Click the link to get the exact time)
2953 days
yea good luck
tysm
bbecause that's the maven convention https://maven.apache.org/guides/getting-started/index.html#what-is-a-snapshot-version
Wont be long until the average 1.8 player wasnt alive when the version came out
i see. So removing that part would fix it then?
-SNAPSHOT is replaced with the timestamp of the actual built .jar
maven then updates snapshots once per day from online repositories
that's the point of snapshots
if you really want to overwrite the same file again and again, you must use ANY version that doesn't end in -SNAPSHOT
e.g. -dev
1.3.3.7-dev e.g., when you install that again, it replaces the existing version in your repo
well, I probably need to rebuild quite frequently, since I'm figuring out how to create libraries right now
the purpose of snapshots is also exactly that they don't overwrite each other, because public repositories usually never allow overwriting existing files
if you uploaded me.whatever-1.0 to maven central, it's there. if you want to overwrite this, no. you must use 1.0.1 etc for the next time, 1.0 is now uploaded and can't be overwritten
and yeah that's the purpose of -SNAPSHOT
javafoc
This automatically creates javadocs and also installs / deploys them
It works, thanks
nothing just the reflection trying to find
yea I've worked with reflection befeore, but not dynamic, so I'm a bit out of my depth here, sorry. Can you step through it with a debugger?
im doing that rn
the field is called "perm" yes, but it's it in CraftHumanEntity, not in CraftPlayer
thanks
found out why, when shading my core the library is already there with the core and it tries to import everything from the core and not from the other library so that's causing to not getting called
I suddenly feel a lot less secure about making libraries lol
just me being stupid
why that?
oh btw please send your pom.xml - I have to check it for one specific, very important common mistake lol
?paste
ok great, looks good. I thought maybe you would be having <createDependencyReducedPom>false in your maven-shade-plugin
because you should never do that
why
but you don't even use the maven-shade-plugin, so all good
because it
- only has downsides
- has not a single advantage
it leads to transitive dependencies being shaded into the plugin that uses the library
meaning, you'll have them twice in the plugin
what is WolrdServer but for nms pleae
i mean, if regular maven does the job
?switchmappings
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
mojmaps is ServerLevel
Imagine LibraryA shades ACF
- Library uses co.aikar.commands and shades it into my.library.acf
- Now PluginB shades LibraryA and relocates it to my.plugin.shaded.my.library
- Now you'll have ACF twice in your plugin: Once at co.aikar.commands (because maven shades it directly into Plugin B because the pom for Library A declares it as dependency and hence it becomes a transitive dependency of Plugin B) and then again at my.plugin.shaded.my.library.acf because that's included in Library A
If you let maven create the dependency-reduced.pom for Library A, then that pom won't include ACF as dependency because it's already shaded and hence the lib doesn't requite as additional dependency anymore
This is the reason why disabling dependency-reduced can lead to problems. ANd disabling it does have not a single advantage
yeah it's really only a problem if you shade stuff into "library A" while also relocating it inside library A's pom and then shade "library A into Plugin B"
ah i do remember now, and why i dont use shading
my argument is 'why waste perfectly good disk space'
?nms npc
https://blog.jeff-media.com/dont-disable-dependency-reduced-xml/ now I don't have to explain this anymore
Many people who are using the maven-shade-plugin commonly set to false for reasons beyond my grasp. This is generally a bad idea, as it can lead to problems if youâre writing a library, and has absolutely no advantages. Hereâs a rule of thumbs: If your project shades dependencies, it should create a dependency-reduced.pom. The...
i have multiple config files but how do i pull from a certen config
well don't you store your custom configs somewhere? in a field? in a list? something?
boys when building surefire does not print to my terminal if/when tests are aborted, let alone the abort message
am I doing something wrong?
@Test
public void test_something() {
/* Code */
}
@BeforeAll
public static void setupAll() {
/* Code */
Assumptions.abort("Some message");
}
my create file section i have created and loaded the file but cant access it
I know that DRM isn't really a thing for spigot, but I wanted to ask if there's a way so that it takes more than 20 minutes and a decompiler to rip out safety checks
I want to make it so that i can hard-code something (IP, hardware serial number etc) into a plugin so it can't be run on other computers than the one it's intended for
you're not allowed to make plugins hard to read
you are allowed to obfuscate code and very rarely to do more if you're allowed
you can't do any of those stuff from your second question
could be classed as trying to crash decompiler mayb
how the f
this isnt about obfuscation lol
I want some way to ensure the plugin can only be run by the one it's made for, but i dont know if that's possible slash allowed
will it be on spigot?
probs not but you know, the moment more than 1 person has access to root...
or for private usage like to a specific person
specific
if it isnt going on spigot, you can do whatever you like
that doesnt actually mean i know how to do it
i mean
i could check if a certain player by UUID has joined a server, or run the plugin file through a hash function, but whats anyone preventing from just ripping out that check
i'm sure you can get the hardware id of a server
just look online
there has to be a way
thats not the issue
the issue is idk how to prevent the plugin to get modified to run anyways
the java part of that website isnt loading, any other ideas?
oh now that i complained it works
typical
oh actually, would it be allowed to publish obfuscated plugins on spigot if an unobfuscated copy is made available to the staff along proof that it's the same logic?
wdym?
you can put an obfuscated plugin up to a limit
where then it becomes too hard to tell what it does then the stuff won't allow you to publish
the published copy has to be readable
i mean if it's still reaedable whats the point
stop in-experienced people
obsfucation on free plugins is entirely pointless
𤡠I'm just curiuos about the details right now
btw is that a restriction on spigot, the codebase, or spigot, the website?
for published stuff i mean
just rules
it's a restriction by the stuff to prevent malicious plugins
we have optic, but optic can do so much
Don't shade that won't work
oh?
Also your plugin will be massive
reflection?
Why include the server in your plugin
so apparantly I'm not allowed to publish any code on spigot
part 4.1.6.4
Anyways just add the spigot dependency
That will work
oh and don't forget to run BuildTools
yes becuz it would be easy to redistribute malware
not what i meant
you think my code is readable?
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>LASTEST</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
im using these and intellij says the groupid and artifactid doesnt exist
then make it readable
Well that's not the dependency you want to be using
That's ancient where did you even find that
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
a lot of googling
Use the spigot artifact instead of api and set version to 1.8.8
im already using spigot for my plugin i just want to use craftbukkit specific classes
The Spigot artifact contains them
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
this is also causing an error
oh dang
does intellij automatically pick up on that or do i need to do seomthing on my part
once youve ran bt reload maven
it can be ran anywhere
^^
BuildTools will put the jar in your maven local for you
So where you run it doesn't matter
huh
?nms
1.8 user
Oh
is it possible to register a command just like registering it into plugin.yml but without actually registering it into plugin.yml just using java code
Then
inject into the command map
For 1.8 @tawdry pilot https://blog.jeff-media.com/using-nms-classes-with-maven/
Many people are confused on how to use NMS classes when theyâre new to writing Bukkit/Spigot plugins because their IDE doesnât find those classes. Donât worry. What is NMS? NMS refers to net.minecraft.server. This package contains all the classes that Mojang wrote for the vanilla Minecraft Server. You can use them to change the serverâs...
You can inject your command in to the command map
using getCommandMap#register?
tysm
Yeah get the command map and register your command
There are quite a few command libs which dont require you to use the plugin.yml for commands.
I prefer every one of them over the bukkit command system.
i don't like the idea of hardcoding stuff into plugin.yml
but it makes sense since the plugins shouldn't have too much power to overwrite other plugin's commands
Dont tell me what to do 
i dont like to have commands at all in plugin-yml, don't think that belongs to the plugin meta info at all
but bukkit being bukkit long time ago made one thing lead to another 
after reloading my maven it says cannot resolve symbol bukkit
?paste your pom
remove the bukkit dependency
oh ok
if you use spigot 1.8.8 for maven, you should only have one dependency: org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT
?paste ur pom
you did not run buildtools
1.8.8-R0.1-SNAPSHOT' not found