#help-development
1 messages · Page 572 of 1
there never was any 1.8.9 server IIRC
wasn't that a client update
1.8.9 is a "client-only" update
mainly yes
anyway, the proper version to use today is 1.20.1
Heyo, quick question - i am trying to cancel the ServerConnectEvent since i am disconnecting the player anyways
but uh, i dont see how i could cancel the event without a reason or server since i kinda dont need em
@EventHandler
public void onServerConnectEvent(ServerConnectEvent event) {
// check if the player is a bedrock player
if (!GeyserApi.api().isBedrockPlayer(event.getPlayer().getUniqueId())) {
logger.info("Player " + event.getPlayer().getName() + " is not a Bedrock player");
return;
}
UUID playerUUID = event.getPlayer().getUniqueId();
Connection connection = GeyserApi.api().connectionByUuid(playerUUID);
if (connection == null) {
logger.error("Connection is null for Bedrock player " + playerUUID);
return;
}
String xuid = connection.xuid();
if (playerCache.containsKey(xuid)) {
// case: player is known to us, redirecting
logger.info("Player known - wants to connect to server: " + playerCache.get(xuid).getName());
event.setTarget(playerCache.remove(xuid));
} else {
logger.info("Player unknown - saving server: " + event.getTarget().getName());
playerCache.put(xuid, event.getTarget());
connection.transfer(plugin.getConfig().getAddress(), plugin.getConfig().getPort());// do we need to cancel the event?
event.setCancelled(true);
}
}
something like this
oh using geyser
add "java" after the first three code block quotes for some syntax highlighting
just fyi, this is the bungee and spigot discord, not sure how much more different geyser is or what they change
System.out.println("test");
``` like this
if you want to prohibit players from joining, cancel CLientConnectEvent
yee
i need to cancel the server switch event, and reconnect em to re-apply packs in geyser, and then have them re-join
ah i got it fixed now for this
However, i keep getting mismatching hashes in my client, are we supposed to be hashing the URL of the resource pack or something else?
well I am pretty sure geyser has its own discord?
I'm aware, but that isnt the issue here xd
i just want to cancel the server switch event - since i am disconnecting the player - without it throwing an error
no, you're supposed to hash the resource pack
sha1sum myresourcepack.zip | awk '{print $1}' > myresourcepack.sha1
the issue isnt geyser related though...
ahhh
I cant do it that way though have to programatically do it, this will be fun x)
you are using their software
tyty
it makes a big difference
hello, I'm trying to make some advancements and track them with persistent data container but im getting this error https://paste.md-5.net/olesetimoz.php here is my code https://paste.md-5.net/fidosubuxo.java sorry im new to this pdc
java got SHA1 integrated
to expect support for someone elses product is quite dumb
ah neat its only a slight method change from my current one im using
Thanks 😄
would of assumed files would of been more intense for some reason
bro
i aint asking about their project, nor do i need to since i contribute there and wrote the Geyser api that i am using in my project.
I am asking about how i would cancel the server connect event here without it trowing an error - the error indicates that i should give it a reason, but i cant find a method in bungee's api to do so.
you are cancelling the ServerConnectEvent although the player hasn't joined any server yet, i.e. is only just joining the whole bungeecord, is that correct?
you cannot cancel that event then, you first have to allow them to join one server, and only then you can cancel switching to other servers
basically, just check if the ServerConnectEvent#getReason() is JOIN_PROXY, and if yes, don't cancel it
can i get/change the server the player would initially connect to in a join/post long event?
yeah, either in bungeecord's config, or through ServerConnectEvent#setTarget(ServerInfo)
just check that you only change the target if the reason is JOIN_PROXY or LOBBY_FALLBACK or however it's called
the config part wouldnt work though since bungee seems to remember the server the player disconnected from and reconnects them there :/
hm i can work with the latter, thanks
np
there is a setting in bungee to not do this
cool, but i want it to work regardless of the setting being on or off
Any idea on how to quickly get a random X and Z position where top Y block isn't water? Right now it's greedy but I fear a cache may be too large
well, can't have everything
either you have it enabled and you deal with them connecting to whever they were at, or you disable it and bungee stops worrying about that and always connects them to the lobby
just generate some random X,Z, then check if getHighestBlockAt(int, int)#getType() is not water, if yes repeat
ofc you should avoid loading new chunks or else it's gonna suck lol
i dont want to mess with how bungee reconnects them, i just need to get the server they are connecting to, reconnect them, and then manually connect them to the server they wanted to go to all along
tldr: bedrock is dumb and only allows to get new resource packs when the client connects - therefore, i need to reconnect the player (using geyser's api), to then apply the packs in the respective geyser event. For that, i need to know the server the client will connect to - hence why i cancel the first join attempt.
then you are going to have to work around that
not sure what you are expecting
you are free to change it in your geyser fork though
if you don't like it
it is literally a bedrock limitation, and i aint complaining about it.. i just wanted to know how i should handle the warning in bungee's api when i cancel the event; that is literally all there is
Thanks to mfnalex, i know how to avoid it. Thanks!
Yeah that's what I have right now but the server I'm testing it on seems to freeze before teleporting
Might be an issue with a plugin though so I'll try it again on a new server
Too old! (Click the link to get the exact time)
most probably won't help with outdated stuff
so will have to wait for someone who doesn't mind
why the heck are you castimg the meta to Object
setOwner is for player names btw
what's the durability for?
I'd use setOwningPlayer on skull meta btw
1.8 moment
In ye old days of pre-1.13, they had to use primitive concepts such as numerical block ids, and a subsection of ids for more specific blocks

Gotta love Skull:3
1.13, 1.14.1 and 1.16.3 were the best API updates ever
Same thing
this wasn't really all that bad
the only people who really complained about this were the ones that couldn't understand how bits worked
You cannot sit here and tell me you know what block id 52 referred to
I have another question:
Can I create a new world and ONLY selectively load the chunks I want?
wasn't hard to find out, but in terms of space ids were better
or which id spruce stairs corners, facing east/north are
because you can if you wanted change what the id's referred to
torches
I have those ids ingrained in my mind
lmao
How can one generate an world where only the chunks I want are allowed to load?
thing is, they could have allowed the client to refer to such things with strings and kept it as ids on the server
but all well people will complain regardless
in terms of efficiency strings are slowest
and use up more space
but it still uses numbers internally
as a byte and it depends on character points being used
strings take up more space. There is never going to be an instance where a string takes less space then a primitive
How to make wither skeletons not give the wither effect when attacking? Spigot 1.20
Can I make a per player border?
sure
Player#setWorldBorder(WorldBorder)
declaration: package: org.bukkit.entity, interface: Player
oh...
This was so much easier than I thought.
Thanks. My mind had the wildest most painfull solutions to what I needed
lol
How could I spawn a structure by its schematic
well, first you get the width and height of your schematic, this lets you get relative coords in regards to where you want to spawn it in at
and then its a matter of traversing the schematic and setting the blocks appropriately
ok, but there isn't a method to do that for you, right?
Worldedit api has stuff to deal with schematics
Otherwise you need to load and parse and place it yourself
ok, thank you
its not hard to implement yourself, I mean I suppose it can be if you don't understand bitshifting and bitmasks etc
otherwise not all that hard
Hey guys. so I have a question.
I am looping through blocks from y 319 down to the first block that isnt Air or Lava
Is there any way around the deprecated boat methods besides using NMS?
for (int y = 319; y >= -64; y--){
if(unsafeLoc.getWorld().getBlockAt((int)unsafeLoc.getX(),y,(int)unsafeLoc.getZ()).getType().equals(Material.AIR)) continue;
if(unsafeLoc.getWorld().getBlockAt((int)unsafeLoc.getX(),y,(int)unsafeLoc.getZ()).getType().equals(Material.LAVA)) continue;
safeLoc.setX(chunkGlobal.getX()+unsafeLoc.getX());
safeLoc.setZ(chunkGlobal.getZ()+unsafeLoc.getZ());
safeLoc.setY(y+1.0);
break;
}
oh the indenting is fucked...
but when I tried it. my server crashed. saying...java.lang.ArrayIndexOutOfBoundsException: Index 180355379 out of bounds for length 315
you add +1 to safeLoc's Y everytime
also you don't need equals to compare enums
also you should be using WorldInfo#getMinHeight() and #getMaxHeight() istead of hardcoded heights
also why don't you start at World#getHighestBlockYAt(int x, int z) instead of startig at the max height?
np. If you just want to find the highest not-air, not-lava block, I'd do it like this:
But why would it give an index out of bounds on y = 315
I dont get the error tbh.
public static Block getHighestUsableBlockAt(World world, int x, int z) {
Block block = world.getHighestBlockAt(x, z);
while(block.getType().isAir() || block.getType() == Material.LAVA) {
block = block.getRelative(0, -1, 0);
if(block.getY() <= world.getMinHeight()) {
return null; // COuldn't find any block
}
}
return block;
}
sth like this is how I'd do it
haven't tested, I don't have any IDE open
whats weirder is the stack trace didnt point to this specific point in the code.
pointed to a different class
show the full stacktrace
?paste
paste it there
I have a suspision it's because the chunk isnt generated yet.
because it worked at spawn
but when I did it far away.. it crashed
are you calling that during chunk generation?
I dont believe so.
it happens on a command
Hey, me again. Can i get the defined forced hosts via the bungee api?
i've a question, can i make an entity invisible for only one player by using packets suppression?
is there a way do edit a player name color but only 1 player can see it ?
and how
ok thx
I love this class name
you should be able to
is there a method in api for it? Could not find one.. "this.getProxy().getConfig()" doesnt seem to have a methd to get the forced hosts
maybe forced hosts isn't part of the api
you could optionally however just read the config file
nothing really, just more complexity
you create a new Object of that, then you can use setCooldown(...) and hasCooldown(...) etc
public class MyCommandExecutor extends CommandExecutor {
private final Cooldown cooldown = new Cooldown();
@Override
public boolean onCommand(CommandSender sender, ...) {
if(cooldown.hasCooldown(sender)) {
sender.sendMessage("You can only use this command once every 20 seconds!");
return true;
}
cooldown.setCooldown(sender, 20, TimeUnit.SECONDS);
// Your command code
}
}
How to make an Event handler that executes after minecraft has already handled the event?
"craftPlayer.getHandle().playerConnection.sendPacket(packet);"playerConnection get error you can resolve it?
Do I need to use priorities or tasks?
delay it by 1 tick using a scheduler
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
so tasks right
yup
Cannot resolve symbol 'playerConnection'
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
are you using mojang mappings?
yes
?switchmappings
im using grandle
it's called "connection", not "playerConnection"
it's also not called sendPacket but just send
you are trying to use spigot mappings instead of mojang mappings
read this
yes but get eroor craftPlayer.getHandle().connection.send(packet);
"get eroor" is not a very detailled description. why don't you tell us WHAT the error says?
Cannot resolve symbol 'connection'
iirc that field is private in 1.20, use getConnection()
Cooldown#getCooldownRemaining(Object, TimeUnit)
i am in 1.19
then you are not using mojang mappings
dude you must learn basic java
obviously "cooldown" is the name of your Cooldown object
i a musing grandle:
repositories {
mavenCentral()
jcenter()
maven {url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven {url = 'https://oss.sonatype.org/content/groups/public/'}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc
1.19-R0.1-SNAPSHOT'
}
you are obviously not using mojang maps, but the obfuscated version
how do i use the remapped version
this is how to use mojang maps in maven ^
grandle?
for gradle, there's no official way to use mojang maps for spigot
paperweight is best way tbh just odn't use any paper methods
ah, i cant use
well but that also means that 90% of methods are deprecated
I'd just use maven for mojang maps on spigot, that's the easiest way
compileOnly 'org.spigotmc
1.17.1-R0.1-SNAPSHOT:remapped-mojang' this?
he said already it won't work on gradle
then your plugin won't run as it's not being remapped
you are stuck with 3 optioons
as I already said twice:
the only official way to use mojang maps for spigot is to use maven
move to maven, use paperweight and dont use paper methods, use a 3rd party gradle special source plugin
maven the easiest answer, tutorial
- move to maven
- read https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
- code
So should I switch to marven?
yes
there is no way?
we are 3 peoples saying, you should consider switching if you want use a feature, probably is not possible in the official way and probably support is not given idk that
there is a way to use mojmaps in gradle but its not an official spigot way
why do you keep asking instead of reading the previous answers
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
ok. i try compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:remapped-mojang' if not found i try at go to marven
code
that will not work it will error if you use any nms
what language you talk?
oh yea, so let me translate to you "Usa Maven" (im learning italian lol)
ok i use marven... how i can trasport grandle to marven
are you using anything in your build.gradle besides repitories { } and dependencies { } ?
nope
then just create a new maven project like this: https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
after that, add the settings for mojang maps, like this:
?nms
?paste
paste your code in this link and send it here
dude for real, it's getting so annoying. YOu have absolutely no clue how java works. You don't know what a class is, nor an instance of it. You try to call methods that are declared in Cooldown.java on a Player object. You keep refusing to read the basic java tutorials. The cooldown class is so extremely easy to use, if you don't even manage to understand that, nobody here can help you.
Why do you keep refusing to read the java tutorials?
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
i create a new project
not the first time?
dolphin.setTarget(player); does not work. Is it possible to fix this?
code
?paste
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
HumanEntity#hasCooldown(Material) requires a Material, not a String -> https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/HumanEntity.html#hasCooldown(org.bukkit.Material)
declaration: package: org.bukkit.entity, interface: HumanEntity
as mfnalex learn java that's not how it works
using marven found! but PacketPlayOutBlockBreakAnimation packet = new PacketPlayOutBlockBreakAnimation(entityId, blockPosition, animationTime); get error because mot import import net.minecraft.network.protocol.game.PacketPlayOutBlockBreakAnimation;
that's not a mojang mapped name
?switchmappings
yes it is <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
read this ^
It takes a vertical position, turns and does not attack the player.
hello, I'm trying to make some advancements and track them with persistent data container but im getting this error about a string being too long https://paste.md-5.net/olesetimoz.php here is my code https://paste.md-5.net/fidosubuxo.java havent used pdc before
<dependency>
<groupId>net.minecraft</groupId>
<artifactId>minecraft</artifactId>
<version>1.19</version>
</dependency> get errorr net.minecraft minecraft 1.19
Could not find artifact net.minecraft:minecraft:pom:1.19 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
For anyone needing a 1.20-ready Server#createWorld based on WorldCreator, well just spent like 2 hours on converting it into new mappings and other stuff.
Here's the code:
https://paste.md-5.net/itopavaris.cs -- Code
https://paste.md-5.net/uwukagayeh.css -- Imports
why the heck are you adding net.minecraft to your dependencies
that code shouldnt cause that error, rerun buildtools for 1.20
@scenic onyx you are trying to using a SPIGOT mapped name, you need the MOJANG mapped name
?paste
I sent them ?switchmappings three times already but they keep ignoring it
import net.minecraft.core.BlockPosition;
import net.minecraft.network.protocol.game.PacketPlayOutBlockBreakAnimation; for import his
I HAVE NO IDEA WHY THIS HAPPENSSSS!!!!! https://paste.md-5.net/efofehegec.http
im out of ideas...
i see it <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>ù
the mojang mapped varient of that is ClientboundBlockDestructionPacket
I have already told you three times that those names are NOT mojang mapped names, but the spigot mapped names. I have also sent the link to convert spigot-mapped names to mojang mapped names three times. If you keep ignoring the tutorial I wrote and sent, then I can't help you
I will now send the blog post a fourth time, if you still keep ignoring that, I'll just block you
just found another mappings site
?switchmappings
actually pretty decent
ah
@scenic onyx
https://mappings.cephx.dev/ this one allows you to search any mapping type and get the class still
very nice
that's from the "how to use mojang maps" blog post, NOT from the "how to switch mappings" post...
it <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>?? is ok?
yes
this other mappings browser is nice
ok but not import PacketPlayOutBlockBreakAnimation and BlockPosition
good bye and good luck fixing your issue while ignoring all the answers you got
yes i have read t
YOU ARE USING THE SPIGOT MAPPING NAMES WHEN YOU SHOULD BE USING THE MOJANG MAPPED NAMES
you have the mojmaps available you just need to use them
don't waste your time on them
they keep using spigot mapped names, completely ignoring the switchmappings blog post lol
i am using!
no you arent
oh wait. Idk jack shit what that is. Ill ignore
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
lmao
yes
that is the dependency
you in your own code are still using spigot mappings, you need to convert
ah ok!!
lmao good luck talking to them. They can't read
lul
Yeah I told them a few days ago too
They don't even need nms for block damage
It's like talking to a wall
no 123 on my discord block list
they are actually updating it
okay. lets maybe focus on a more productive issue (cough, like mine, cough)
:))))
nice
ill call it now, they saw that you needed nms on a kody simpson youtube video
oh lol
i still did find another like great site
Probably
that allows me to search any mapping name and get the mojmap class
hahahah i have now Understood
idk screaming sandals is way more comfortable imho
yeah
ugh
the other website looks weird and it's quite cluttered with different namespaces I don't wanna search in
that guy is such a bad teacher for actually good practice
this is by the same people lmfao
they are upgrading their project to be better and faster thus deprecating the old one
makes sense
https://paste.md-5.net/iledonifaq.xml you are happy?
the new mappings browser isn't only ugly and mixes up all namespaces in the search, it also doesn't show the list of interfaces something implements
open a feature request https://github.com/zlataovce/takenaka/issues
nah I'll just continue to use the original, better site
they're deprecating it at some point
which will also cause it not to get new versions
(probably)
they say we'll continue updating NMSMapper's generator for as long as you'll need it
oh wait that's only for the reflection stuff
i have do all but it not import. https://paste.md-5.net/iledonifaq.xml
@rough drift ur italian right
hello?
wtf
I thought i was timed out
anyways... Id love some help with this stacktrace https://paste.md-5.net/efofehegec.http
is that a crash log
Yes. It happened when I was trying to get the first block on a Y coord that isnt AIR or LAVA
paste the full crash log
the code is here.
public static Location getSafeLocation(Chunk chunk, Location unsafeLoc){
Location safeLoc = new Location(unsafeLoc.getWorld(),unsafeLoc.getX(),unsafeLoc.getY(),unsafeLoc.getZ());
Location chunkGlobal = new Location(unsafeLoc.getWorld(),(chunk.getX() >> 4),1,(chunk.getZ() >> 4));
safeLoc.setX(chunkGlobal.getX()+unsafeLoc.getX());
safeLoc.setZ(chunkGlobal.getZ()+unsafeLoc.getZ());
safeLoc.setY(getHighestUsableBlockAt(unsafeLoc.getWorld(),(int)safeLoc.getX(),(int)safeLoc.getZ()).getY()+1.0);
return safeLoc;
}
public static Block getHighestUsableBlockAt(World world, int x, int z) {
Block block = world.getHighestBlockAt(x, z);
while(block.getType().isAir() || block.getType() == Material.LAVA) {
block = block.getRelative(0, -1, 0);
if(block.getY() <= world.getMinHeight()) {
return null; // Couldn't find any block
}
}
return block;
}
can I somehow use an "instance" of vanilla chunk generator?
like when in World Creator you supply null generator, it uses the vanilla
how can I manually set the vanilla chunk generator?
im gonna guess its the while loop
well.. I pasted the code
here
but it's weird because it should work...
I dont even know where the error is from
if anything this crash log isnt caused from that
does it still happen with no other plugins on he server
okay. how can I know where it's from?
not tested.
binary search
remove half, see if it still happens, if it does remove half again
half of...
the plugins
im gonna take a guess this was tested on a prod server
and It happens when I type the command I made
Sir. Im jsut a guy hosting for some friends. If by prod you mean a frat minecraft server, then yes.
test it localhost with no other plugins
aight.... alot asetup is needed then <.<
run buildtools, accept eula, done
could use paper if you really want
if you use gradle
there is a gradle plugin to spawn a server for you
with a single gradle task
run paper smh

personally i dont want to create a server dir in every plugin i want to test
i have enough disk space i just dont want to create a server dir everywhere
lot easier to just change dest dir
on it. How do I specify which version I want
--rev version
ok....
open gitbash/powershell/command promt where the jar is and java -jar Buildtools.jar --rev version
yeah
no

thats why i dont want latest

latest isnt 1.20.1 yet iirc
intersting
concerning 1.20 has some fun bugs/data loss issues
at least in vanilla, dunno if that applies to spigot
'java' is not recognized as an internal or external command,
wat...
I am certain i got java
leme test
probably isnt on path
17, id hope you have one installed if your playing mc
i got 20
is that bad?
that should work
WELL I THOUGHT I DID. minecraft ran for years on my machine
okay says it's done
the spigot-1.20.jar is the one u'll need
I am trying to give entities glowing effect that are only visible by a player (so not just applying the effect but rather using protocollib)
Here's my function that doesn't work
public static void applyGlow(Player receiver, Entity entity) {
ProtocolManager pm = ProtocolLibrary.getProtocolManager();
pm = ProtocolLibrary.getProtocolManager();
PacketContainer packet = pm.createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet.getIntegers().write(0, receiver.getEntityId());
WrappedDataWatcher watcher = packet.getDataWatcherModifier().read(0);
watcher.setEntity(receiver);
watcher.setObject(0, (byte) (0x40));
final List<WrappedDataValue> wrappedDataValueList = Lists.newArrayList();
watcher.getWatchableObjects().stream().filter(Objects::nonNull).forEach(entry -> {
final WrappedDataWatcher.WrappedDataWatcherObject dataWatcherObject = entry.getWatcherObject();
wrappedDataValueList.add(new WrappedDataValue(dataWatcherObject.getIndex(), dataWatcherObject.getSerializer(), entry.getRawValue()));
});
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
try {
pm.sendServerPacket(receiver, packet);
} catch (Exception e) {
e.printStackTrace();
}
}
Currently crashes the client and throws an error in console
provide the client and server logs ?
How long does it take to verify a premium resource? I’m just wondering so I can plan stuff out
2-4 weeks iirc
Oh damnnnn, okay
OKAY its doing it finally i think
wow its taking long
i dont remember setting up a server taking that long
whats the difference between build tools and just a spigot server
You shouldn't be using the WrappedDataWatcher above 1.19
this is what you want
buildtools create the spigot server
we cant legally distribuite spigot jars
Can u send me this as text?
no I don't spoon-feed
Bruh how is that spoon feeding
okay i got 1.20.1, switching to 1.20
U sent me it as an image
¯_(ツ)_/¯
One thing is copypasting the answer
Another is writing it for yourself while looking at a guide
Bruh I anyways have to modify this
i dont think that's really fair either.
If you really want the text then run it through ocr
and get fucked when it types fieldIndex:
sharex has that feature too
It's a bit dumb
and not accurate at all
but just write it yourself
Dont you guys copy paste your research results and modify the code to fit yours?
Yea that's what I am always doing
That's like one of the best ways to learn from copypasted code
I copy paste, get like 10 syntax errors and delete all the uneeded stuff
Damn. sticks and stone tools
Not really
but whatever works for you i guess
You only learn to appreciate something if you understand it
Unless it's something braindead and stupid like uhh
this
That's fine to copypaste
@remote swallow sire why does it still show me I have 1.20.1
no clue
oh just file naming
nvm
so what port is that server again??
25524 or smth
if only 1 server is running on ur local ip yeah
okay. tested. Crashes the server
Btw this doesn't even work
only my plugin exists on local
It still causes the client to crash after a few seconds
I am on 1.20
Is there a way to store (temporary, non presistent) data into a player? Something like pdc but non-presistent
thank you
If you don't want to use an api you can create a class with all the data, and then have a hashmap linked to a player's uuid and that class
that's what I wanted to skip
How do I change the speed at which blocks can be mined? I don't mean with mining fatigue/haste, since that isn't very variable and also changes the speed at which your hand moves, I mean changing how fast you mine a specific block.
So I just cast whatever I want into a MetadataValue object?
ProtocolManager pm = ProtocolLibrary.getProtocolManager();
PacketContainer packet = pm.createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet.getIntegers().write(0, receiver.getEntityId());
List<WrappedDataValue> dataValues = Lists.newArrayList();
dataValues.add(new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x40));
packet.getIntegers().write(0, receiver.getEntityId());
packet.getDataValueCollectionModifier().write(0, dataValues);
try {
pm.sendServerPacket(receiver, packet);
} catch (Exception e) {
e.printStackTrace();
}
This is my current code which crashes the client
(this is the client's crash exit code -1073741819)
And to get current arena of player, is this castable too ? I don't see any errors in IDE. It should return null if player has no arena.
ill tryandsee
!tryandsee
?tryandsee
Server wise I dont think you can... You can maybe check when a PlayerInteractEvent if it's a left click and they're breaking that certain block
set an async timer and break the block after your desired timeout
make sure to check that the player is still looking at that block they were mining.
but still, even then. a player can leftclick a block once and look at it without holding down the mouse
But what about the cracks on the block?
What you do is give negative mining fatigue. That will prevent cracks in the block. Then simply listen to the block damage and block damage abort event
You can probably figure out the rest
You can give negative potion effects?
Doubt it - never heard of it
I think he means a harmful potion: mining fatiuge
Yup, still
not inverted mining fatigue
you can deff give a player a potion effect..
I mean for that potion he's lucky that mining fatigue is the opposite of haste
yea I know
But besides that you can't really reverse potion effects
I can't case Location to Metadatavalue
How can I add a location as a metadatavalue for player?
public void teleportToArena(Player joiningPlayer,String arenaName ) {
if( this.arenaExists(arenaName) ) {
ArenaModel arenaModel = arenas.get(arenaName);
joiningPlayer.setMetadata("locationBeforeArena", (MetadataValue) joiningPlayer.getLocation());
joiningPlayer.setMetadata("currentArena",(MetadataValue) arenaModel);
joiningPlayer.teleport(arenaModel.getLobbySpawn());
arenaModel.getCurrentPlayers().add(joiningPlayer.getUniqueId());
String message = String.format("§f%s§e joined! §a(%d/2)",joiningPlayer.getName(),arenaModel.getCurrentPlayers().size());
arenaModel.annunceMessage(message);
}
}
public void teleportFromArena(Player quitingPlayer) {
ArenaModel playerArena = this.getPlayerArena(quitingPlayer);
playerArena.getCurrentPlayers().remove(quitingPlayer.getUniqueId());
quitingPlayer.teleport( (Location) quitingPlayer.getMetadata("locationBeforeArena").get(0));
String message = String.format("§f$s§e left! (§a(%d/2)",quitingPlayer.getName(),playerArena.getCurrentPlayers().size());
playerArena.annunceMessage(message);
}
declaration: package: org.bukkit.metadata, class: FixedMetadataValue
alright
apparently org.bukkit.event.block.BlockPlaceEvent.getBlock isn't a thing anymore?
Anyone know about this?
it inherits it from BlockEvent so it should most definately exist
Did you name your class "BlockPlaceEvent"?
is the import correct
the crash still happens, sir. I have been try catching all over... everything crashes still....
report it as a bug on jira ig
😅
i got a different crash report tho.
is your package in it now
wdym?
?paste the crash log
OH!!!
still doesnt include any plugin classes, report it as a bug
?jira
so i mean. lemme see how to explain it
int x_chunk = new Random().nextInt();
int z_chunk = new Random().nextInt();
gameChunk = new Location(main.GAME_WORLD, x_chunk, 20, z_chunk).getChunk();
does that break the game?
its too big of an int probably
use something like ThreadLocalRandom.current().nextInt(10000)
what is the 315 tho?
height map mayb
okay leme see
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Block b = event.getBlockPlaced();
b.getLocation();
int x = b.getX();
int y = b.getY();
int z = b.getZ();
}
How do I make those integers public? So I can use them in other classes
other way around
++value returns then does stuff, value++ does it then returns
Hello, I am having some troubles understanding angles, I am trying to make a ring of fireballs around the player when they right click the ground, here is the code I have so far. ```java
else if (pChest.isSimilar(blazeChestplate)){
int angleChange = 360 / fireballs * 2;
for (int i = 0; i <= fireballs; i++) {
Fireball fireball = (Fireball) world.spawn(player.getEyeLocation().setDirection(new Vector(0,0,0)), Fireball.class);
fireball.setDirection(new Vector(angleChange * i, 0, 90));
}
}
fireballs is 8 btw
all it does is fire straight at the ground
WORKED!!!!!!
OMFG
Is this a EulerAngles situation?
hey how do i install buildtools
unlikely
?bt
yeah i got the jar and setup it on windows
for it to fire in a circle at least two cords would need to be != 0
Hi, could someone tell me how I can disable a TextComponent as soon as I click on it?
but the progress so far is that i have the folder with buildtools in it.
but you only set x
open gitbash/command promt/ powershell there
in chat?
but now how do i add that so that intellij actually works for
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
have you ran buildtools
how ☠️
?bt
do you have the jar installed
yeah
.
Yes
now type java -jar BuildTools.jar --rev ver
a@DESKTOP-EVOI9U7 MINGW64 ~
$ java -jar BuildTools.jar --rev ver
Error: Unable to access jarfile BuildTools.jar
then you cannot without clearing the chat in it's entirety
Are you in the right directory
you arent in the folder
cd C:\Users\a\Downloads\Plateou\BuildTools
ok
then java -jar BuildTools.jar --rev 1.20.1
Sure ? Is there a variant?
public static void startGeneratorScheduler() {
Main plugin = getInstance();
Bukkit.getScheduler().runTaskTimer(me.Bamle.Main.getInstance(), () -> {
Location generatorLocation = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
generatorLocation.getWorld().dropItem(generatorLocation.add(0.5, 1.0, 0.5), new ItemStack(Material.DIAMOND));
}, 0, 100); // 100 ticks = 5 seconds
}
I get an error at the parenthesis at "startGeneratorScheduler()"
"error"
100%. But if it is a command you could just add logic to just not process the command if it is invoked twice
doesn't tell me what, just a red line under it
try compiling, it will tell you
hover over it
ok that works now
OKkk
ah wait
The version you have requested to build requires Java versions between [Java
17, Java 20], but you are using Java 8
specify the direct path to java.exe in java17
linux?
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
as linux
specify direct path to java
is that windows
in windows it wants the .exe on linux it has no extension
do you have linux or windows
"illegal start of expression"
i have windows
so you install windows
i thought u run it like buildtools
you dont have the right java version to run buildtools
If you have linux use sudo alternatives --config java
After installing the right java version through your package manager (unless you already did that that is)
isnt it java 17 not jdk
oh
I am having much trouble with the fireball ring
you can't put method into another method
still doesnt work with jdk
specify the path to it
the file path
path to jdk?
to the java.exe in the jdk
Use new Vector(1, 0, 0).rotateAroundAxis(new Vector(0, 1, 0), angle) instead as the direction vector
jdk-version/bin/java.exe
thats java 8
There is a more sane way of implementing this behaviour but this should work for the moment
you need 17
OpenJDK17U-jdk_x64_windows_hotspot_17.0.7_7
It gives the same error anyways
once installed yes
show what you did
recompile as well
what do i do with that
C:\Users\a\Downloads
do you have an msi file
yes
double click it
yes
then follow the instructions
i installed
hey, is there any good tutorial on how to make a multi-version compatable spigot plugin?
I just put the static outside of the event
now get the instalation path
I have learnt to not trust that ppl did what they think they did
send the edited code
where is angle defined?
now go to c:\users\Program Files\ its either in Java, Eclipse Adoptium or Eclipse Foundation
The angle is basically your 360 / fireballs * i I reckon
me?
?
its still in the method
yes
C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot
yes
I forgot to move the brackets lol
?
what do i do wit dat
bro...
now go into the bin folder then find java.exe
then at the top of your screen press copy path
this isn't python
indentation is meaningless
Well I know, just a stupid mistake
C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot\bin
yes its in that file
click it once to select it and press the copy path button
Actually it could also be (2 * Math.PI) / fireballs * i, the documentation is not clear on that.
@trail carbon
i dont have a copy path
press the drop down arrow on the top right
yeah
now go back into gitbash, paste it and you should end up with "C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot\bin\java.exe" -jar BuildTools.jar --rev 1.20.1
if I make a plugin for 1.8.9, will it still work in 1.20?
what does that mean?=
1.8.8 is the server version, if you dont use nms it will work
1.8.9 was never realeased as a server version, it is a client only version, 1.8.8 is the server version
i gotta reopen it?
yeah
ok
just wait for it to finish
ima save the thing then
It can. It could also not. Depends on how careful you are
so if i create a 1.8.8 plugin it will still work on all versions?
its a simple plugin
not much
👌
Invoking event constructors could for example be the end
@quiet ice Thank you, that worked, however now the fireballs are bouncing on each other
is there any special maven dep i need to use?
just the 1.8.8 api
once it finishes running you will have a spigot-1.20.1.jar in the folder BuildTools.jar is in that is your server jar
okay?
so i dont have to change
do you need buildtools for plugin dev then?
is in that your server jar
yea
intellij
i need the jars or something
use maven
i have that yeah
do you know java
i just needed buildtools for the classes
yeah
i take computer shiene
but yeah my dev has a whole core made already
and i just needed to modify sendactionbar some random classes and add my own
so do i import these jars
what do you need to modify that for
visuals
change the maven dep
you just call the method
what
you cant change server code and have it change on the client too
im new to intellij
wdym
if you change code on the server to make something look different on the client it wont work, you would need to change the client code
ok its fully installed
how do i add images
what version?
verify
for example
Try doing following instead:
double angle = (Math.PI * 2) / fireballs * i;
Vector dir = new Vector(1, 0, 0).rotateAroundY(angle);
fireball.setDirection(dir);
fireball.setLocation(fireball.getLocation().add(dir));
import net.minecraft.world.entity.player.EntityHuman;
1.8.8-R0.1-SNAPSHOT
thx
When I do Chunk.getX() getZ(), why are the coords not exactly on one of the edges of the chunk?
ok there
its the chunk coords
theres block and chunk coords
change the import
to wat
spigot instead of spigot-api
okay.. so how do I get the exact edge block of a chunk?
me or who
no those are nms ones
wait.. getblock
so buildtools
ahh
check where the chunk coord ends up if you times it by 16
yeah, changing the import gives you nms access
how do i change them ☠️
you have a dev? why isnt he doing it
spigot-api not spigot
yeah
pedro
he devs for donutsmp
change the spigot-api to spigot
and he isnt doing this because?
i changed spigot to spigot-api
oh no because i can modify it from github
but its like i need to test yk
?bootrap
Hello, how can I get the particle of the block break ?
how do i teleport an entity to another so that it is one block to the right?
those imports are nms, you ran buildtools for 1.20.1, you needed 1.19.4 im guessing
wait
oh right
☠️
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
(also applies to future versions)
someone should update that to the spigot jars since 1.18
get the location of the target mob and change it by one
then teleport it to that location
and at the same time take into account the rotation of the entity
can anyone help fix this? https://paste.md-5.net/samuzahipi.java
Here is the console error: https://paste.md-5.net/ikivigilad.cs
Plugin is null
read the stacktrace. Main.getInstance() returns null
But reading is hard :(
@remote swallow I created a plugin with version 1.8.8 but it gives me an error
there is no "api version" 1.8.8
the following api versions exist:
1.13, 1.14, 1.15, 1.16, ... 1.20
oh
for 1.8.8, do not set any api version
u mean in the yml
if it's set, legacy material support is disabled
if it's unset, legacy material support is enabled
so what would u recommend?
which versions is your plugin supposed to run on?
1.13
Use 1.13 then
alr
but then you get issues with materials
I would not set any API version and use legacy material names
oooor: I'd not support anything below 1.16, easiest fix
Hello i am having this error with my code when executing a command
thx now it works!
you are doing getConfig().getString("blabla").equals(...) somewhere, although your config doesn't have a value assigned to "blabla"
but it does though
power: 0.16559999999999997
amount: 100.0
totalvalue: 18.0
economic-activity: 0.9199999999999999
description: defaultDescription
peers: 1
author: RGn3
team:
RGn3:
mint: true
deposit: true
rename: true
description: true```
this is what the config is like
Why does this return empty
data.getStringList("stakes")
with this yml?
stakes:
test:
price: 111
because "stakes" is not a StringList but a ConfigurationSection
here i am looking for the name of the root 'oki' then looking for the child "author" of the root so like this
name + ".author"
Do I have to implement all methods when I wanna make anew worldborder() ??????
this-is-a-string-list:
- "asd"
- "asd2"
Oh I see
this:
is:
a: configuration section
this-is-a-map-list:
- name: "mfnalex"
age: 28
- name: "someone else"
age: 999
you are not supposed to create your own instance of worldborder
you are supposed to use the factory method in the Bukkit class
declaration: package: org.bukkit, class: Bukkit
ahhhh!!
okay thanks
what's Currency1_19 line 220?
@tender shard thanks for the help btw
np
needed you to translate something earlier
How do I remove a key from a configuration section?
I tried data.getConfigurationSection("stakes").set(name, null); but if I opened the file it was still there
you also have to set the config section back
ConfigurationSection section = getConfig().getConfigurationSection("stakes");
section.set("name", null);
getConfig().set("stakes", section);
saveConfig();
grr spigot now requiring 2fa to post an update? 😦
Im not using the config.yml Im using a custom yml file and I still have the same problem after updating my code. I think its something with dataFile not updating? Not sure
private void save() {
try {
data.save(dataFile);
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Failed to log data.");
}
}
public void removeStake(String name) {
ConfigurationSection section = data.getConfigurationSection("stakes");
section.set(name, null);
data.set("stakes", section);
save();
}```
Hello, about a week ago I bought a plugin [ItemsAdder] I thought it was a correct platform, it turns out that they haven't delivered my plugin yet...
Ig spigot doesnt give support on others platforms
was that on spigot?
spingot or spigot?
send link
wrong channel
then you should message support
#general
also that
what?
How do I send a message to support?
click here #general and ask again.
thanks
long millis = System.currentTimeMillis();
player.chat("test");
System.out.println(System.currentTimeMillis() - millis);
Dang that function is slow for some reason. It's 2-4ms
Probably faking packets or whatever
theres no way its 4ms
do you have a chat listener running
Thats not Spigot
whoo^ps
is there any event to catch when a player switches his hotbar selected item?
inventoryClickEvent
Alright without the chat listener it's somewhat consistent 2ms. Rarely 1
How would I check a player's reach? I've tried using pythagoras to find it. By using an event to find out when someone attacks:
package AC.Checks.Combat;
import AC.Checks.Main;
import AC.Checks.Return.ReturnChatMessage;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import java.text.DecimalFormat;
public class Reach implements Listener {
public Double difference(Double a, Double b) {
Double toReturn = Math.abs(a - b);
return toReturn;
}
public double round(double d) {
DecimalFormat twoDForm = new DecimalFormat("#.###");
return Double.valueOf(twoDForm.format(d));
}
@EventHandler
public void attackEntity(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player) {
Player attacker = (Player) event.getDamager();
Entity attacked = (Entity) event.getEntity();
Integer minDetection = Integer.valueOf(Main.plugin.getConfig().getString("AC.Logs.Reach.MinDistance"));
Double distX = difference(attacker.getLocation().getX(), attacked.getLocation().getX());
Double distZ = difference(attacker.getLocation().getZ(), attacked.getLocation().getZ());
Double distY = difference(attacker.getLocation().getY(), attacked.getLocation().getY());
Double reachDist = round(Math.sqrt((distX * distX) + (distZ * distZ) + (distY * distY)));
if (reachDist > minDetection) {
new ReturnChatMessage().ReturnChatMessage("&4" + attacker.getName().toString() + "&7 has failed &4Reach &7[" + reachDist + "]&r", Main.plugin.getConfig().getString("AC.Logs.Reach.ViewReachPermission"));
}
}
}
}
However this just constantly false-flags? Any ideas?
oh no
I mean when he uses the mouse wheel to get a new item in main hand from his hotbar
why are you creating a double wrapper
yep
?
yes thx
use a primitive
private void save() {
try {
data.save(dataFile);
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Failed to log data.");
}
}
public void removeStake(String name) {
ConfigurationSection section = data.getConfigurationSection("stakes");
section.set(name, null);
data.set("stakes." + name, null);
save();
}```
Everytime I do this it works untill I reload or restart server. Is it possible this is because i run saveDefaultConfig in onEnable?
did you assign getConfig() to a local variable? if yes theres your problem
@tranquil prairie
I am not using getConfig() its a custom yml file
Full class: https://paste.md-5.net/moqozinobo.cpp
omfg im so stupid
i left in a line that created it each time for testing
why is stuff static and other stuff public
also YamlConfiguration.loadConfiguration() is a thing
ig that was a mistake
translate what
Make sure you are using correct numbers, idk exactly what it returns but it might returns kilobytes for ram.
tell someone they were using spigot mappings when they needed to use mojmaps, we got there in the end dw
jree
turns out 0x1.0p-53 is a valid double literal
So sanity check question / hot take...
CommandExecutor... its is really daft the parameters were not collated into some sort of "CommandSenderInfo" class.
Because thats a lot of parameters that just make Javadocs a mess.
Have I missed something? Or is it just poor practice thats crept through the many forks as "god if we do that a lot of a stuff is gonna break" ?
you are talking about ::onCommand?
Just in general tbh, onTabComplete has the same issue
dont see any problems with it
neither did i until this:
If we pretend it isnt onCommand for a second and just think of it in terms of "number of parameters for a method" , we'd probably rinse the dude who made a method like this lol
i used the params from onCommand to do something else and was making java docs and well... lol
4 params isn’t that much
wait until you see jdk methods will 16 params
I think my ide yells at me past 7