#help-development
1 messages · Page 149 of 1
how? im an stupid
fourteen you're literally blind
didnt see p.getname first
you're still blind
getBoolean(path) returns either true|false
getBoolean(path + ".true") is just stupid
LOL fourteen
would require
something:
name:
true: false
smh ill go back to c++
it will be working?
sorry ❤️
but yeah imma hit the local mcdonalds it's lunch time
gotta sell a shower in an hour because if I don't use it I might as well just make some money
already eaten second lunch
it will
whatcha getting fam
i made a big code and only one thing is didnt work
remember guys never try to answer a java question when doin c++
like this
"anvil." + pl + ".enabled"
why not doing like
anvil:
first-player: true
second-player: false```
i made it
but it didnt work
how do i need check then
getBoolean("anvil." + player.getName())
anyways store Player#getUniqueId instead of Player#getName too
name might change
you can login to your minecraft profile and change your username, thats what i mean
idk by having a whitelist on name ig
if not implemented by uuid internally anyways
It might be specific to my country, but theres a burger called "McRoyal Bacon"
that sounds nice
gimmie
Has no veggies, just meat, custom sauce and bacon
Decent game
Got mf 700pp
only rank 156k rn D:
I got 2x 200pp
's yesterday tho
which is fucking pog
osu! » player info » ignPurple
relax I love
haha
you play an rx server? ezppfarm, akatsuki, ripple?
oh my god its working thanks to everyone to help russian stupid develope
Omw to McDonald's
kingg
Gotta pass through the boonies
Just wait until you ask me a stupid nms question
ahaha
Touch screen
I'm just tryna get my reading skills + speed up @quaint mantle
haha
;D
got the ending diff too
can't haha
I'll do the ending
that's all
haha
when #help-development descends to osu

I'm trying to make it so that you can have up to double the normal enchantment levels but not allow conflicting enchantments, but the latter doesn't seem to be working for reasons I don't understand, any ideas?
https://github.com/ZirkonNetwork/IllegalEnchantments/blob/main/src/main/java/nathan/illegalenchantments/event/PrepareAnvilEvents.java
Also yes, I know this is pretty shit
osu! » beatmaps » King Julien XIII (CV: Sacha Baron Cohen) - I Like to Move It (Cut Ver.)
this is a good one
@quaint mantle This too - https://osu.ppy.sh/beatmapsets/1462039#osu/3003629
osu! » beatmaps » Various Artists - Speed Jumps
haha I have that one too
so relatable
ignore my score
alr
that was ages ag
I told you it was shit
I had no braincells left when I was like half way through writing it and when I slightly improved it I lost half of them by reading it
I mean
this looks delicious
except it has bacon which i cant eat
Is there an API way to get all Permissions a plugin offers?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/plugin/PluginDescriptionFile.html#getPermissions() this maybe?
declaration: package: org.bukkit.plugin, class: PluginDescriptionFile
So long as they're declared in the plugin.yml, then yes that's correct
(as they should be, but as we all know... devs don't always do what they should)
Stop abusing static
What a troll
??
Bukkit.getOfflinePlayer(); ?
Ah its bungee sorry
@quaint mantle i am better than you mate
I am not abusing static anymore
So I cant get offline player from bungee?
Is there a way to do it, when they don't
Reflection is fair play
No and no to both of those questions lol

You actually dont
Permissions are plugin-agnostic for the most part
sad
Bruh.
The ones declared in the plugin.yml are instantiated and added to the plugin manager but it doesn't retain which plugin registered them
You have bigger brain man.. Sorry
So how can I check if an offline player has x permission?
your naming conventions are dead and you're static abusing, well technically it isnt static abuse from what you sent us, but you definitely dont know why you used static for your plugin variable
I can't?
You can't
:///
You can't even do that for Bukkit
You would have to go through your permissions plugin if you have one
are player permissions nodes saved in data files? kekw
No, Vault requires online players
It actually requires a CommandSender which is... weird
okay I made it slightly better
https://github.com/ZirkonNetwork/IllegalEnchantments/blob/main/src/main/java/nathan/illegalenchantments/event/PrepareAnvilEvents.java
luckperms api says just to check player's permission. Ironic
LMFAO
Right because online proxy players have a hasPermission() method. But if you want to query the permissions of an offline player, you'll have to use LuckPerms' API to query the database with a UUID
I mean that Permissible is the more appropriate option
All CommandSenders are Permissible, but Permissible is the correct type
he's not static abusing no cap, he's just creating an instance of the class to grab a (probably) static final Map. Which is still a very very weird way of doing it. I would recommend using dependency injection to get your Storage class that way, then you don't need to constantly create a new instance of the class to get a field. You just do storage.map or storage.getMap() however you have it laid out.

hi mr chocolate ❤️
cant believe that people are still instantiating bukkitrunnables, i mean use scheduler
😢
Mister choco... You are so dum
Bukkit.getScheduler go brt
They can send commands :)
Mister? pfp says other thing
what the fuck
Yeah. All entities have the ability to send commands too
It doesn't often happen, but it certainly can
just a preference
No, the command block is executing that
i usually make bukkitrunnable variable and run it directly
what did you just say...
So ignoring that it's probably still pretty shit and hurts your eyes, any idea why this is happening?
I don't think there's really any other way to do something like that without a mess of ifs
what u said made no sense
i only use a bukkitrunnable when my class extends it
not me
I used to extend StaticAbusers but they realized how bad it is, so they removed it from me
iin this case you shoud have a proxy for List btw
something like
public interface StaticAbusers extends List<StaticAbuser> { }
not really required, but convenient
🤔
How can i add health to a player?
i made it like this
player.setHealth(player.getHealth() + 6);
but if the player haven't - 6 of health it doesn't do anything
change health attribute base value first guess
?
Anyone?
anyone what?
Have any idea what the issue with conflicting enchantments is
They're being added when they shouldn't be
maybe clean up that code first
There's nothing to clean up
It's just going to be a mess because of what it has to do
@vivid skiff add a Math.max to ensure it doesn’t go beyond player.getMaxHealth()
The extent of cleaning up that I was able to do was putting similar functions in one method and reusing calls
Hi guys I've a problem with build tools. I've run the tool with the --generate-docs --generate-source --remapped args but i can't find the jar with source or docs
I wonder if I'd get in trouble if I made my plugin play chug jug with you every time you beat a boss fight
I'm trying to check when an item hits the ground. For this i'm using a method that performs a while loop trying to check when item.isOnGround() returns true. However, this doesn't work because I need to update the item instance somehow.
How can I do this?
this would never work
your while loop will run on the same tick
you're checking the same state over an over again
use a scheduled repeating task
imagine dropping an item from 200blocks high and then doing a while loop
Oh that's true. Maybe that's why it doesn't work, and the isOnGround method actually doesn't just return a constant
Thanks
imagine dropping it from 1 block high and crashing your server
sheesh
I wonder if I could rig intellij to play segments of chug jug on every compile
hmmm
Likely
weird the premade stuff has a before compilation field but not a post-compilation field
clearly jetbrains fears these advanced programming techniques
Does anyone had any success installing CB sources into mvn local repo through the build tools?
Anyone know why PlayerLaunchProjectileEvent is only working on select projectiles?
according to the javadocs, it should work on every projectile, but from what I've found it only works on things like eggs and snowballs, and not tridents, bows, or crossbows
I'm getting no console errors or anything
ProjectileLaunchEvent works on everything, but i need to be able to get the player that launches it and the ItemStack it was from
any thoughts?
you scare me sometimes
how i can make damage the armor the player is wearing
is there a way to get a method handle to a package private method
because i need fast invocation
and im pretty sure method handles are faster than reflection right
greatness can be terrifying to mere mortals
what can I do if packets are being lost or aren't being sent, how do I find the issue
Minecraft uses a TCP connection. Packets can;t be lost
7smile7 said that the packet may be "randoly lost"
but what reason would there be for a player not be getting the packet?
I teleport a mob and like 1/4 of the time a player doesn't see the update while a different player on the server DOES see the update
(the mob will look different on the two player's screens)
have you actually monitored the client side packets incoming?
I have not...
Well as I said, MC uses a TCP connection so packets are in a stream one after the other. they are sequential and can;t be "lost" unless the connection is lost too.
look, I was just saing what 7smile7 said
He was talking about waterfall. That I don't know
I see
Server to client can;t lose packets. Adding in a proxy I can only see it dropping a packet if it was malformed.
try this?
no
thats still only server side
well, it would tell you if it was skipping a player
should I do that on onPacketSending?
you really need to test on the server and client end to see if the packet is sent/received
that's what I am trying to do
as its TCP its pretty much impossible for it to get lost in transit
I thought that you could monitor packets by using the PacketListener
do you have anything on teh client to monitor packets?
I don't
is that a mod?
Is there a PersistentDataContainer for blocks that I can use to simply store a string that I can look at later to tell if a player placed the block or not? I know that you can check if GetState of a block is an instance of TileState but idk if every block has a tilestate or not
what's that
Much better. Its up to date
Anyone know an easy way to intentionally crash a server with a plugin?
divide by 0 doesnt work :((
For what reason?
Bukkit.shutdown()
i'll probably just spawn a bazillion entities or something if all else fails
Time.sleep(100000L) on the main thread!
but why
shrugs
won't Long.MAX_VALUE be even beter
nah fam
A recursive method?
I see
too anticlimactic
I mean
just don't upload the plugin to spigot then
maliciously crashing a server won't be healthy for your account
oh yeah
ofc
uhh
excuse me
how did the server NOT crash
for (int i = 0; i < 10000; i++) {
e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.ARROW);
}
bcs it doesnt take that long?
MORE
seems like it maxes out at around 12000 before u get a proper crash
SCIENCE!
huh
i seem to have killed my server
maybe 10000000 was too many...
lmfao
Does anyone know a way that I can check if a player moves an item from a custom inventory to their player inventory? I'm trying to make an inventory which you can move items around in, but I don't want them to be able to actually take the items from the inventory
is there a event to detect when player equip armor?
There isn't one in Spigot
thanks
💀 brah hell no
is it possible to bundle multiple packets and send them at once
lmao
im going to do particle stuff soon and dont want to ddos people
I doubt that's possible with netty, unless there's a mysterious way
What are you going to do with packets? Any estimated on how many particles there's going to be
ill always save you people
uh i just found the upper limit with testing
which's about 6000
beyond that it stutters
omg it's that
md should start paying me for reportign shit
PluginMetrics one 😭
the issue is you do NEED a lotta particles to do anything that aint a straight line
dude this pakkit executable is sick ASF
yo is there any way to convert Block to Material?
Why
block.getType() == material
but it doesnt work
getType gets colored red, aka cant find a method
i have imported import org.bukkit.block.Block;
btw
what~? colored red is not Spigot
cant resolve method apologies
ok thanks online code
that error says you don;t have a block, you have an ArrayList
Why are you calling getType on an ArrayList?
i want to clear out all blocks in a certain area EXCEPT a chosen one
Just loop through the ArrayList and check the material
Ehh somewhat
then... how??
You just gotta cover a shaped perimeter
Something along these lines
for(Block block : list) {
if(block.getType == Material.WHATEVER) continue;
// Do whatever here
}```
OH SHIT
okay yeah my bad
i apologize
just found out
I WAS CHECKING IN ARRAY LIST
me dumb smh
ikr
Only acceptable if the name is either:
- x
- y
- z
INDICATION
I used to work with people who would also name Events e and Players p and it annoyed me to no end
uhhhhhhhh
I used to be that guy like 3 years ago
you better dont work with me
Back in like... 2019
I used to when I started until I realized how ugly it looked
howd u do it
Just use your density inside the loop
dw i will start trying to use full words
And sending particles every second instead of every tick
and increase plugin size by 50 bytes 🙄
hm, do particles have modifiable lifespan?
No
shiet
Hardcoded
so the more complicated the thing i want to draw the more particles i need to send at once
Also latency can make it look flashy
yea thats what i meant by it stops working
can u elaborate what exactly you mean? Sending packets spread over a few server ticks to give netty a chance to catch up?
also why'd the ping be important
Basically you only want to send as few particles as possible
To not burn your cpu, and not burn your network card lol
super flat is minecraft:flat or superflat?
Ideally you'd send 1 packet / particle / lifespan
Why does if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) not run for InventoryClickEvent
yea thats the intention but that still totals almost 4000 even for simpler shapes
Thing is, it'd look flashy if it took longer to arrive than the lifespan
You can:
- send particles async
- define x particles per tick
- resend on a longer interval
Or be like me and copy 7smile7's code
wasnt aware u could do that async. That might help, but im about 90% sure the issue is the client and not the server
Cull particles
Send less
More particles = more server time
But also more client time
wait no
neither actually lags
the issue is that the volume of particles isnt coming through at once if too many get sent
some network issue
thats why i asked if i could bundle em
Or rather why doesn't it work for dragging to a different inventory. It only works when shift clicking
Each particle is a single packet
And you can only display 16k particles at once
Client limitation
must be 16k particle packets because i can send particle packets with the particle number set to 10, resulting in 6000 particles but 60k rendered ones
Sure
or do you mean that it can only spawn internally 16k particles at once?
point
Does anyone know how I can check if a player moves an item from an inventory to their player inventory? I've been stuck on it for like an hour and I can't figure anything out
?bukkitevents
Inventory Click Event
I've tried doing it through InventoryClickEvent
And checking if the Action is MOVE_TO_OTHER_INVENTORY and it only works for shift clicking
Can I check if it moves to a different inventory in DragEvent?
You gotta handle clicking cursor on main gui
But also know where the cursor item comes from
Yeah but how would I do that
Idk I'm a developer I google things
I've exhausted the possible ways to Google the same question
Believe me I'm running out of it
I just cannot seem to figure out how to stop dragging between inventories
It's the only thing I'm stuck on
DragEvent for that
Yeah I know that
But like I can't figure out how to check if it actually moves to another inventory
I mean would checking the inventory after the drag event and seeing if the item isn't there work?
Very hacky
time for a stress test
1.2 million particles
Have you tried recompiling?
yes
Either caused by the plugin being disabled or being caused by the plugin not having that class
And what is it?
nvm i lied
And this isn't an API or something?
nope
Although plugin being disabled most likely does not apply here given that it would usually say that the classloader is closed
respawn handler just respawns the player at xyz coordinates
Hmm if you've tried recompiling then there might be an issue with your IDE when compiling?
Just fork us over the jar and perhaps we'll see whats wrong from there
IDEA is known to have issues with its cache
I can second that
Intellij?
Yea
Yeah
What do you use geol?
Eclipse
yeah reloading idea didn't help
I started with eclipse and went to intellij, not sure what i prefer tbh, intellij was really confusing at first
You could always decompile the JAR file and see if the class is there at all
Which if theres a NoClassDefFoundError I imagine it's not but it's worth a try
Hence my comment about giving us the jar
have at it
CNFE/NCDFE can happen even if the class is actually present in the jar
So class init error. Time to get recaf up and running
Wait
One sec
I don't know if this matter but the package says Handlers (capitalized)
But the jar has it lowercase
does not
wtf works fine now?=??
Recaf at least doesn't differentiate, java on the other hand...
But Recaf and URLClassLoader should have similar constraints
can i use lambdas to create a bukkit runnable
So yeah, probably an instance of a cache being blown up
Watcha mean?
BukkitRunnable probably is a FunctionalInterface, so most likely
If not, use a wrapper
want to pass a runnable to a method
but dont want to do the new runnable stuff if i dont have to
Suppliers?
You can do Bukkit.getScheduler().runTaskTimer(plugin, () -> { // code }, delay, time) or something if thats what you mean
yea
Lambdas still allocate a new object, even if not explicitly
Suppliers too technically though
I'm having weird visual bugs with this:
@EventHandler(priority = EventPriority.LOWEST)
public void e(InventoryClickEvent e) {
e.setCancelled(true);
}
When an item is clicked, the event is cancelled; however, A fake version of the clicked item appears on the players cursor.
hm different question. If i do create a runnable via a lambda that uses variables of the method its initialized in, does it still point to those variables or does it clone them
Clone as in?
int b = a
For primtives the value is copied, for L-type values (so everything else) the reference is
Lambdas cannot make use of mutable variables
If you cannot add final to the variable declaration without compiler errors, you cannot use the variable in the lambda by design
Although you probably know that already...
well they can be internally mutable if internally initialized
im passing some values but they dont change
Java has no concept of HARD-copying objects, so generally it is hard to define clones (do shallow copies count? Do deep copies counts? Does reference passing count as cloning?)
my brain is like, if it doesnt change the previous variable, its a clone
So reference passing
yea also the limit for particles before it gives me issues is about 1024
i tested in powers of 2
and with issues i mean visual lag
btw particles can be sent async right?
They are sent async by default iirc
is spigot compatible with modded things ? like if i wanted to make a plugin that repairs an item, is it possible to make it work with modded items ?
Spigot does not support mods
technically its possible but u really, really shouldnt
What sort of modded items?
If you are talking fabric (and forks)/forge/spongevanilla kind of modded - then no, not possible
Unless you are using one of all those compatibility layers that exist, but then the experience greatly varies and you should define the constraints further
If you just mean "how can I set the damage to 0", then just do exactly that - should work on all vanilla and most modded items. (Unless you are in a version prior to 1.13)
what is the best way to cancel the AsyncPlayerChatEvent for players only and not the console?
Logger?
?jd-s
yes setting the damage to 0 is the goal, just wasnt sure if it would work on modded items at all because the spigot plugin that we are using on our server has the repair command, but doesnt work on our modded items at all
1.12?
1.16.5
And with modded you mean slimefun (and similar) kind of modded or fabric (and forks)/forge/spongevanilla kind of modded?
yeah, forge
Using Adventure?
basically e.getRecepients().clear() i guess
Then it is likely caused by the compatibility layer not correctly implementing the methods the spigot plugin uses
Adventure?
i mean i ended up using getconsolesender instead but im still curious
var i = or e.getRecepients().iterator();
while (i.hasNext()) {
if (i.next() instanceof Player p) e.getRecepients().remove(p);
}```
bukkit logger outputs weird characters so idk
What kind of wierd characters?
exp.
or basically cancel the message end use Bukkit.getConsoleSender().sendMessage(e.getMessage());
any way to fix this or is this just an error with the compatibility layer itself ?
žfUSERNAMEž>žMESSAGE
And you using String#format?
aye
Hi. What method should I use to get the item used to break a block on a BlockBreakEvent, e.getPlayer().getItemInUse() or #getItemInMainHand?
Then probably an issue with ANSI, hence why I asked about adventure
well im using the translatealternatecolorcodes
Adventure has a dedicated lib for that built-in
link me
The bukkit logger does not support color codes
mainhand
but actually there should be a getter in the event itself
like getItem() which returns what player used to break block
I think there isn't any method like this. The options I found were the one I said before. Thank you 🙂
Or Adventure-Plattform-bukkit
If I'd knew the impl I could give hints how to solve it, but chances are the compatbility layer is bork
But that's to be expected from a non-bukkit impl.
for the spawn entity packet in protocol lib, are the velocity actually integers even though on the wiki it says short ?
It can very well be that they are cast down to shorts after being ints
say i have a function and all it does is generate random points in a sphere, say 100 of those points
i also want to be able to check if each of those points is inside a solid, and if so, to ignore that point and keep generating them until i get to 100 points
however, i only want to do that SOMETIMES, other times i want to generate those points inside solids
i just use a boolean to say whether or not in this particular instance i generate them outside of solids
how do i do that without having an if statement repeated 100 times checking that boolean OR having what amounts to two blocks of almost the exact same code with the only difference being that check if they are inside solids
on the wiki it says short but when i use PacketContainer#getShorts() it says that 0 is out of bounds for length 0
while (locationList.size() < 100) {
double thisLocRadius = outerRadius*(Math.pow((1-((1-(innerRadius/outerRadius))*random())), 1.0/3.0));
double theta = (1-(2*Math.random())) * Math.PI * (arcAngle/360) + Math.PI;
double phi = Math.acos((2.0 * Math.random() - 1.0)*(arcAngle/360));
double x = thisLocRadius * Math.sin(phi) * Math.cos(theta);
double y = thisLocRadius * Math.sin(phi) * Math.sin(theta);
double z = thisLocRadius * Math.cos(phi);
Vector vect = new Vector(x, y, z);
if (!((noSolids) && (origin.clone().add(vect).getBlock().getType().isSolid()))) {
locationList.add(origin.clone().add(vect));
}
}
it's just the last if (!((noSolids) && (origin.clone().add(vect).getBlock().getType().isSolid()))) {
locationList.add(origin.clone().add(vect));
}
Alternatively you could go ask on #mcdevs@irc.libera.chat - could very well be that it has changed lately
which is bothering me
You could just have a Set<Location> or somewhat like that
whats that
https://web.libera.chat/gamja/ is probably the easiest option
System.out is only one static
yeah i deleted the message where said there are 2
with what?
nvm
Hey ! im looking for locate a command block, i have this class https://hastebin.com/qirefofixu.java and i have this error when i try to execute my command https://hastebin.com/ezaxiqubit.properties do you have any idea of what i can do to get the command block ? ty so much for any help
Hey real quick, what's the formating for adding 1.19 release to the gradle build file?
compileOnly 'org.spigotmc:spigot-api:1.19' ?
I need support
there is always this 0.1-R.0-SNAPSHOT thing at the end
Ah alright
health support
Yes!
Thank you!
Specially for drugs
Close. 1.19.2-R0.1-SNAPSHOT
isnt only 1.19-SNASHOT?
I mean, if you're writing against 1.19, then yeah
but you always have the -R0.1-SNAPSHOT at the end of all versions
Whst nenas gja g
Yes
What means that?
So if you were to compile against 1.19, you'd use 1.19-R0.1-SNAPSHOT
The words are mixed because cellphone is in Spanish
Chocó for example what the diff between R1-Snapshoot and R3-Snapshot
How can i heal a player of a specific number of hearth:
I made it like this right now, but if a player have like 2 hearts of damage it doesn' t heal the player.
player.setHealth(player.getHealth() + 6);
You've seen internal package names with different revisions
The API version however has always been R0.1
In 1.8 you have R1 and R3
Yeah those are package names. The dependency is still 1.8.8-R0.1-SNAPSHOT
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.14.3-SNAPSHOT/ Would like a talk with you
But those are all pre-release/debug/ea builds
Yeah they're not stable builds
So I want to make a plugin to let me place blocks in spectator mode. According to this (https://www.spigotmc.org/threads/set-blocks-in-spectators.262217/) post I can override blockcanbuildevent and set it to true to acomplish this. I've made a listener, but I'm not sure what to do in my main method, and where to register the listener
According to this (https://www.spigotmc.org/wiki/using-the-event-api/?noRedirect=1) post I'm supposed to do it in the main class, which confuses me
@quiet ice do you perhaps have a mongodb class i could use its way too late and i cant bother writing my own
To obtain the plugin instance you can use JavaPlugin#getProvidingPlugin
I.e. the catch-all-cant-be-bothered method would be JavaPlugin.getProvidingPlugin(new Object() {}.getClass())
oh damn
Of course using DI (i.e. passing the plugin instance along) is better, but one can be lazy for one-time setup code
You aren't forced to use this however
never worked with DBs
I'm just making one very simple method for this (if the method I'm planning around works)
🥹
Hey, DataOutputStream/DataInputStream is the best girl around town - at least in my opinion
le what
(not to be confused with ObjectOutputStream/ObjectInputStream)
doesnt DIS reset when the server stops
ByteBuffers but on streamed
You'll want to write it to a file anyways (https://github.com/Geolykt/Presence/blob/main/src/main/java/de/geolykt/presence/common/PresenceData.java#L289-L332 being an expample of that happening)
https://imgur.com/a/zBUEUa3
am I supposed to just put the classname withing the brackets? I removed them and did this instead
ill check it out
the brackets were intended as it would create an anonymous class
ah okay, but how would I actually write the code? This miiight require more reading, I'm familiar with java but this is a lot to take in hahaha
Just to be clear - that alone does not register an event. It only returns the plugin's class that you can use to register an event
plublic class MyPlugin extends JavaPlugin {
public void onEnable() {
getServer().getPluginManager().registerEvents(new MyListener(), this);
}
}
public class MyListener implements Listener {
@EventHandler
public void onEvent(Event x) {
System.out.println("You can't listen for the \"Event\" class directly though. You'd need to listen for a subclass of it");
}
}
Being an example
However you can register the listener anywhere by using Bukkit.getServer().getPluginManager().registerEvents(new MyListener(), JavaPlugin.getProvidingPlugin(new Object() {}.getClass()));
Soo something like this?
Thank you so much for the help btw!!
It's be public void onEvent(BlockCanBuildEvent event), but yes
How can i save player data like
Members:
- UUID1
- UUID2
- ...
Thank you! I'll try to see if I can make it work then :D
Just put a List<UUID> in your yaml?
I don't know how to do it, i searched online but i can't understand very well how to do it
People are too stupid, so that approach does not work
They will not figure out that they need to change the class name
trust me, I tried plenty of times.
The anonymous class is also needed because there are other people that want to use it in a static context
Hi, I have a question. If I refund a plugin because I don't like it, does spigot ban my account?
You have read the terms and conditions like any good user, you should know it
Also don't ask in every channel
Basically: It is possible they will, it is possible they wont
^^^^
man I didn't even know they made mc servers out there with 50gb of ram
im using protocol lib, what clientbound packet should I use when a living entity is spawned?
get highest block on the location you want to teleport player
SPAWN_LIVING_ENTITY
I got a java system running on 100gb ram lol
player.teleport(loc.getWorld().getHighestBlockAt(yourChangedLoc).getLocation().clone().add(0, 1, 0))
yeah
then just make an algorithm for finding perfect spot
you can get this location you made
and set y to current player's y
and after that teleport at your new location
Action action;
if (args[0].equalsIgnoreCase("assign") || args[0].equalsIgnoreCase("unassign")) {
try {
action = Action.valueOf(args[0].toUpperCase());
} catch (Exception e) {
}
}
Any cleaner way of doing this lol
most of the geometry i made had .normalize()
yes
if (args[0].matches("assign|unassign") {
try {
var action = Action.valueOf(args[0].toUpperCase());
// here you do the rest of the code
} catch (Exception ignored) {}
}```
huh. TIL
?
".matches"
impl'd in 1.4
don't worry i learned it only 6 months ago
feels bad
next time create circle of 12 particles
and rotate it 180 degrees each second
you will need sin and cos
to place particles on a circle
and to rotate every particle
if you want mafs in minecraft
try making circles with sin/cos
once i had to code plugin
Which simulated solar system in minecraft
so basically i had planets which were all rotating around the sun
and i had zones around planets which teleported players to another bungeecord server when they entered it
yeah
i didn't know about sql and redis
PacketType.Play.Server.SPAWN_ENTITY_LIVING ?
so i synced everything with bungeecord plugin messaging
well planets are on different distances from the sun
so i needed to multiply
omg i cant believe
yea
bro why
btw once made location wrapper
SimpleLocation
with magnitude, flatMagnitude, flatDistance methods
tagged every "distance" as deprecated
basically go to university
spend one year
and you are done
what actually you are trying to make @wind blaze
teleport player 1 block forward
in direction where he looks?
ye
it says Could not find packet for type SPAWN_ENTITY_LIVING
is it implemented in your current ProtocolLib version
doesn't ProtocolLib have some wiki
im pretty sure its out of date..
so like if you move player to the left he will look a bit to the right after tp?
like he will look on the same block after tp
or just on the same direction, but x blocks left
var loc = player.getLocation();
var vec = loc.getDirection().normalize().rotateAroundY(loc.getYaw()).multiply(3);
player.teleport(loc.add(vec));```
like this
ye
Location playerLoc = player.getLocation();
Vector direction = playerLoc.getDirection().normalize();
Vector rotated = direction.rotateAroundY(playerLoc.getYaw();
Vector finalOffset = rotated.multiply(3);
player.teleport(playerLoc.add(finalOffset);
cuz you look staright up
no x no z
both zeros
did you apply normalize() btw
i changed
try
or try ImIllusion's code
You could just put them in an ArrayList instead of having two commands
so you would know that if the player is in the arraylist the next time he uses the command its always unassign
Nothing toggle related, was doing something w/ PDC's
not to you @vagrant stratus
Ah
we just made matches
now it's all good
you can send full code
so we can make it 2 times smaller
oh today's the day
LPR and DPR ref
as far as i remember
I've already made it as small as I can lol
i have a topic on forum
still can be smaller
)))
I however prefer readable code
I'm trying to make it so that you can have up to double the normal enchantment levels but not allow conflicting enchantments, but the latter doesn't seem to be working for unknown reasons, any ideas?
https://github.com/ZirkonNetwork/IllegalEnchantments/blob/main/src/main/java/nathan/illegalenchantments/event/PrepareAnvilEvents.java
- I also don't need every little thing as small as it can be
I know it's a mess, but there's not really any other way to get something like this to work afaik
Hi I am getting an error where for some reason my enums are having initialization errors? don't quite get why, does anyone know?
Error: https://hastebin.com/viyerexawi.properties
Code:
ShopItems enum: https://hastebin.com/mocixitoka.yaml
Shops enum: https://hastebin.com/apavezuqok.java
Trades enum: https://hastebin.com/behofuginu.java
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
- use var
- use static imports
don't know what's the problem tho
Static imports for what?
I do however need to deal w/ rewriting a parser to be less shit @fluid river 😂
Doesn't even handle operators :/
for making your code smaller
var - small code
I mean on what specifically
from what I can tell it's basically useless in this case
your goal
I had no idea what it was because I usually only use J1.8
Pretty much yea
There's nothing that can be statically imported
You don't really need static imports either
again, best to just ignore Nuker lmao
Am I even calling anything that's static outside of that event class lol
yeah just had to read all 200 lines
Quite a lot of duplicate code though, surely you can throw some of that into a method @shadow gazelle
to find only once case of static import
final Map<Enchantment, Integer> resultEnchantments = result.getEnchantments();
var is useless he says
Could be wrong but it seems like your variable at line 16 is null. Currently the code is equivalent to = null;
Nothing there is static...?
.
nonon
not here
anvilInventory.setMaximumRepairCost(IllegalEnchantments.maximumLevel);
the only real case where you use static
Noticed that now that you mentioned it
you will have to initialize it at some point
thought there are more
Not a big deal tbh
It's an enum, it doesn't have to be manually initialized, right?
I never had to do that before.
streamapi goes brrr
could it be because of the cross-reference?
var seems like more useless shit added to Java like a lot of it has been recently
with ShopItems.getPrice
List<HashMap<String, HashMap<Integer, Function<UUID, Location>>>> list = inst.getList();
or very few use cases
List<HashMap<String, HashMap<Integer, Function<UUID, Location>>>> list = inst.getList();
imagine writing it manually
yeah, not doing any of that
The var keyword is only allowed when the type of the variable is already clear at compile-time. Also, it will generate the same bytecode, so there is nothing to fear.
It's default value will always be null if not initialized. I think you do have to do this no matter if its an enum or not
yes
As I said, I'm not 100% sure so this might be wrong
and regardless, var hides what's what
IMHO, that is more readable then var
@vagrant stratus so any ideas about what's wrong with the conflicting enchantments?
Than*
omagaad
Not really more readable, but more useful
get List in your case can literally return anything
not sure how im supposed to manually initialize an enum, I actually had no problems with this before I tried to implement the trading stuff into shopitems/menu system
just for example
I would not dig its return type if looking at your code
You may be on the right track with the null thing
I said regarding your example
literally used it everywhere
mostly in loops
Honestly I've never had a reason to use var
starting up IDE
to not write HashMap generics on var
lol yep - that was the exact reason
and List generics
Meh
Nice!
and long class names
Not really an issue w/ the long class names. I just have my IDE autocomplete
seems to be for people who like javascript 💀
that's what I was thinking
and are too lazy to actually define what their variable is
By the way, are your prices ever changing in the shop, cause if not you might be better of using a map instead of enums
bro's trying to write JS in Java
They don't change during gameplay except for when there's a discount for a certain in-game class, but I already have a method to calculate that and it works fine.
The Enum is basically just a config file for the base price and item stats/names/description
No I get it, its good you got it working
var townKey = new NamespacedKey(this, "townyraids-town");
var list = new ArrayList<String>();
var mayor = itown.getTown().getMayor();
var dRegions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(dLoc.getWorld())).getApplicableRegions(BukkitAdapter.asBlockVector(dLoc));
for (var e : placeTasks.entrySet()) {}
for (var t : tasks.keySet()) {}
var meta = defendersItem.getItemMeta();
for (var t : towns) {}
var tm = TownyRaids.getInstance().getTitleManager();
mostly useful if you don't even know what is the returned type
so after you made variable var
you can hover on it and get it's type printed on the screen
not knowing the return type almost never happens
happens a lot
no it really doesn't
WGAPI class
is renamed every version
TitleManager or TitleManagerAPI
I still don't know what is the class real name
return type
oh, right instances
an API really shouldn't be changing names so much
not even my
it's an API
either way, not exactly a massive use-case
shitty APIs with developers that don't know the definition of continuity
instead of var
I'm actually in the middle of making an Economy Plugin and was thinking about adding in a custom shop too
or write like ItemMeta, SQLWarDataHandler, or NamespacedKey
too long for me
not worth my time
🤡
I've been debating how to set it up, but do you think its better with just a normal shopconfig or
If you don't plan on releasing the plugin on spigot, an enum COULD work for you
It could potentially be easier
However you prefer to do it is up to you, it pretty much just comes down to preference
And also application in some cases, like with a bungeecord some may choose to have some information in the server db
just figured that sell prices / buy prices displayname and lore should be displayed so a user can change it
Oh yeah, if you want a user to configure it then by all means use a config file.
I dont know if I'm going to release it publicly but I will distribute it to specified users
I don't ever plan to release my plugin to spigot so that's why I'm going to just keep it as an enum
I use enums for a lot of things, even configuring some game mechanics.
is ur plugin working?
this is what i mean by this
Unfortunately my own test server is not able to be port forwarded - my landlord is the only one with router access 😂 - but i have a public server
just doesn't have the latest code on it
Just curious, what's this for?
No worries, I could just join if u want
The Clash Royale enum caught my attention
playing the minigames takes 2 players
😛
can you accept my friend req so i can dm you the ip?
This is an enum which has a config for basically all of my minigames that I'm working on
the clash royale one you see is indeed what you think it is
hmm
a recreation of CR in minecraft
Clash Royale minigame :EYES:
it is playable if you want
I do
ok i'll dm you ip
yep
it works
goddamnit
forgot one exclamation mark and it broke half of the functionality
cool
sometimes I wonder if I should just get a ton of modellers and make a full crazy frog movie within minecraft
Can you create a mysql database on the mc server
What
does anyone know why this says 0 is out of bounds of range 0
packet.getShorts()
.write(0, (short) vector.getX())
.write(1, (short) vector.getY())
.write(2, (short) vector.getZ());
its for a spawn entity packet
Field index 0 is out of bounds for length 0
on the wiki it says the shorts are for velocity