#help-development
1 messages · Page 1808 of 1
from me
oh
there's something called minimappings viewer you could use alternatively
yeah but some things were missing there and also everytime some errors occur ...
havent experienced that but probably true
Since there's no runtime mappings anymore i highly doubt it
idk how much love it has as of now so yeah
https://minidigger.github.io/MiniMappingViewer/#/mojang/server/1.18.1-pre1/NBTTagCompound
it doesnt know what NBTTagCompound is 😦
MiniMappingViewer
because its name is CompoundTag tho
yeah but spigot is NBTTagCompound ... so if you want to translate from spigot back to mojang it will not find this
how do i print a hashset without []
String.join
o
I just see in the bukkit player class there's sendEquipmentChange,hideEntity,showEntity method. But when I try to use that, the method doesn't exist? (I did try to remove my maven cache)
Sorry for asking twice, because it got buried away 😅
what version do you use ?
well there's only spigot -> moj for 1.16.5 and older
1.17.1
i think it was 1.18 stuff
👀 Ah flip. Okay thanks
wow equipment change is cool
to old 🙂 but anyway... easy to find out what the realname is
yue
@ivory sleet in 1.17 its called sendPacket and in 1.18 its a. What to do about that? Use your filter thing to find the method? any better way?
i think the filter method should work for every? version ....
yeah should
but im just wondering if thats overkill
if theres an easier way
but ill just use that i guess
once you found the method you could safe it .... so just 1 search after reload ... safes some time
type is Method i assume?
seperate classes for each version ... but the filter is good enought
smth like this yeah
doesnt work in 1.18 also
how to get the spigot 1.18 api without buildtools
well just fetch what version it is at runtime and then switch the invocation implementation depending on version
from the repository
how would i make it so if the list is 2 it does
value1 and value2
if it's 3 it does: value1, value2, and value3
current code: String.join("&f, ", list)
WTH. spigot hate me
if length == 2:
// and
else if length > 2:
// join
no but you can write
Sting s = arg.get(0) + " and " + arg.get(1)
though it wouldn't be too hard recreating that dxkyy
just recursively delete all files in all directories
how would I do that?😅
create a method that lists all files and deletes the file if empty or call the method again
i went with the filter, as that should work in every new version too, unless they completely change the method.
public static void sendPacket(Player player, Packet<?> packet) {
try {
Object handle = player.getClass().getMethod("getHandle").invoke(player);
Object playerConnection = handle.getClass().getField("b").get(handle);
Method sendPacket = Arrays.stream(playerConnection.getClass().getDeclaredMethods()).filter(m -> m.getReturnType() == void.class && m.getParameterTypes().length == 1 && m.getParameterTypes()[0] == Packet.class).findFirst().orElse(null);
if (sendPacket != null) sendPacket.invoke(playerConnection, packet);
} catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) {
e.printStackTrace();
}
}
Works on 1.17.1 and 1.18.
For everyone who needs a cross-version sendPacket function, feel free to use.
Anything i could improve?
can someone pls send me the 1.18 spigot api dm?
why not use buildtools ?
I wont compile the jar
Hmm I mean
Check what version then just get the method directly
you don;t need anyone to send you teh API, via maven its pulled for you
wait theres a way?
I thought u meant like if version == 1.17 : sendPacket = a; else if version == 1.18 : sendPacket = b
well nothing I tried worked
what do u mean by get it directly depending on version?
then whatever you tried you did wrong
build tools dont work maven dont work nothing works
Damn just make multiple modules
it works for everyone but you then
wym modules
Make an Impl for every version, without reflection
but how xD i have no idea how thats supposed to work
nah that sucks, then i have to update my plugin every version
xD
But you'd have to do the same with reflection..
no?
my plugin now works fine for 1.17.1 and 1.18
same jar
thats what the reflection is for in the first place
?paste
no thats not what the reflection is for
wym
whats the error here?
yes what exactly
line 19 on that screen is }
yes thats the line
@eternal oxide ?
why Main.instance and Main.plugin
BiConsumer<Object,Object> packetSender;
switch (Bukkit.getVersion()) {
case "1.18":
packetSender = new BiConsumer<Object,Object>() {
Method method;
{
try{
method = /get method with refl/
catch(ReflectiveOperationException e){
//handle
}
}
@Override public void accept(Object o0, Object o1) {
method.invoke(o0,o1); //try catch same exception
}
};
}
Smtng like that (then o0 would be the connection, and o1 the packet)
And then you’d instantiate a slight different consumer for 1.17
Where the way of getting the method might be different or such
that is not a normal bt log
🙄
i see
thats the BuildTools.log
im blind sometimes
sec and I'll rerun mine
Dont you have to update plugin every version aswell in this case
But yeah a polymorphistic design with version per module is probably cleaner as you get the help from the compiler and such
Yeah pretty much
Are there any advantages of this, compared to using a filter
The best way is just not using nms smh
spigot is Suuuuper limited
You cache the method, and then invoke it
no way to not use nms sometimes
0aper
is limited too
So advantageous is that it’s probably a bit faster
true
Why so you need packets
relative teleporting,
20 fps maps
Your log says your scriptus is corrupt/bad C:\Users\Philipp\.m2\repository\net\md-5\scriptus\0.4.1\scriptus-0.4.1.pom
relative teleporting was even proposed and has like 20 likes, but md_5 was just like "nah, dont need that, dont see the point"
make a pr
well the file doesnt even exists
what does relative teleporting mean
teleporting without loosing velocity
do you have a scriptus folder?
no way to do that without packets
not that I would know
unless u set the velocity back one tick later (cant set it back in the same tick, idk why). but that wont work in a 1-tick repeating task scheduler
wel browse to teh .m2 folder and check
I dont have a .m2 folder
well now it finds it I only have scriptus 0.4.1
delete teh scriptus folder adn rerun buildtools
it recreates the 0,4,1
and its still the same error
exactly the same? scriptus pom?
yes
oh and per-player world borders
@eternal oxide can you just send me the jar file?
if i do config.set("Balance", 0) is it in memory until i do config.save
yez
You don;t actually need the jar even with your buildtools failing
and how would i get the value from memory?
the api is in the spigot repository
but It would work
by loading the config and using .get ?
won't work?
config.getInt()
as i can understand packets are used only for stuff that is not supported by mojang or intended to work like that but works
that gets it from the hdd config
I always used the jar files because maven never worked
or for stuff that spigot was just to lazy to implement. like relative teleportation. mojang has a whole packet for that
If spigot doesnt accept the pull request, paper is way to go
(secret)
cant use paper if u want ur plugin to work on spigot
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
why is spigot even a thing, like why not team up with paper and make it one?
It’s quite complicated
i'm sure it's cached, i was getting values from config when i wasnt able to save and there was nothing in the file
@eternal oxide pls send it
is there anything that spigot does better than paper?
Then you need to work out why your maven is failing. Likely the same issue thats killing your scriptus pom in your .m2
does spigot maybe not skip ticks under extreme lag?
cuz thats like the only downsite i know about paper
breaks redstone filters n stuff
oh wait, ill better ask this in general
isnt rlly development related
The only advantage is plugin marketplace
or idk how to call it
Does anyone here has experience with proguard obfuscation? I'm getting lots of errors like
Warning: proguard.gradle.ProGuardTask: can't find superclass or interface org.gradle.api.DefaultTask
Warning: proguard.gradle.plugin.ProGuardPlugin: can't find superclass or interface org.gradle.api.Plugin
Warning: proguard.gradle.plugin.android.AndroidPlugin: can't find superclass or interface org.gradle.api.Plugin
``` and 416 more...
Seems like proguard is trying to obfuscate itself
the bigger amount of plugins?
the first thing I'd try is, delete your scriptus folder, disable your Defender/antivirus, then run Buildtools again
why cant you just send the .jar file
The place to post plugins which you can find on google
i have this:
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
File file = new File(Nucleus.instance.getDataFolder() + File.separator + "playerdata" + File.separator + sender.getName().toLowerCase() + ".yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
config.set("Balance", 500);
System.out.println(config.get("Balance"));
return true;
}```
prints 500, but when i do /bal it doesn't show the same value
ah, yeah, true, thats great
save it
you dont safe the config
ik
config.save(configfile)
what when a crash happens?
saving it on world save
paper is developing their own plugin repository but that would take time to make it popular
but if you load the config from the file somewhere else it isnt safed there ...
just safe it
yes
the loaded Configuration
for each player?
saving it isnt that hard
u could make a HashMap<Player, YamlConfiguration>
but could cause lag
HashMap<UUID,YamlConfiguration>
dont use the player instance
no
i know a server that saves stuff on command, and by spamming the command with 10 accounts 20 times per sec u can actually crash the server
so not a good idea to save on command i guess
How can I get getAttachedFace() from a sign?
why should u
then you could add a delay because its not usefull to have a cmd that can run 20times/s
why not. ofc u should make it a weak hashmap so it deletes after player leaves
save async
why that?
to crash the server. maybe to dupe stuff
just dont call it will plenty people
idk, i always crashed it for fun
lol
Player Object has a lot off memory usage... and its very easy to remove the uuid on PlayerQuitEvent ...
still not working
isnt it a simple pointer under the hood??
is there a way i can make a race track and code it so i can see where players are on that track, and how many blocks ahead of someone they are?
how can i get the player that shot / threw a projectile?
when doing a hashmap it just gets the player and hashes the object, i dont get ur memory point
Players are kept in a WeakHashMap. If you keep a reference to a Player object you will prevent it being GC'd when its due.
get the shooter of the projectile and check if it was a player
but where or why would you keep a reference after the player leaves
yeah and how can iget the shooter?
projectile.getShooter() ?
By mistake, bug or just forgetful
hmm alright xD
but spigot doesnt keep a reference, right?
would have to be an error by myself right
uuid is safer ^^
^
alright
i honestly don’t even need to see exactly where someone is on the track, i just need to know who’s first second third etc, and a way to calculate distance in blocks to the next player
p.getLocation().distance(otherP.getLocation())
kinda cringe that i can remove a list of vanished uuids in config and just store the state in the player itself
This solution would only work if the race track is a straight line, if it’s cyclical or lap based, you’re going to have more work to do
yeah but it seems like he doesnt event know how to find out the distance between 2 points ... or how to calculate who is the first and second ...
oh ok
Why is org.bukkit.material.Sign deprecated?
it tells you in the javadoc
all usage of MaterialData is deprecated and subject to removal. Use BlockData.
is there a way to sort of “draw” a line that players have to go along with code and see how many blocks away from the end they are?
you can spawn particles is all
you can spawn particles in a line from the player to the portal, i would recommend doing this for a limited range tho.
i mean not a visible line, i mean an imaginary line that i can track in code
you mean a vector?
i’m new to coding so idk what that is
is that what i would use?
i can look into it if so
vector is something to do with math
Vector is a thing you might learn in math too
basically a defined direction without a starting point
ok do you need distance or a line that points towards the end
Yeah but org.bukkit.material.Sign has more features.
java.lang.RuntimeException: Error running command, return status !=0: [C:\Windows\system32\cmd.exe, /D, /C, C:\Users\Philipp\Desktop\DEV\BT\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=3353, clean, install] any ideas for solution?
a distance but i can prolly compare the distance each player is to the end and place them that way
i need to see who’s first and so on, and i was gonna translate the block number into seconds depending on how many there are till the player gets to the end
and tell the player a time based on that
What are you looking for
this is what youre looking for. replace the entity at the start with the player and the Parameter with the location of the end portal
?
that gives you the distance between player and portal. it returns a double
will it lag a server if i’m doing that for maybe 20-30 players?
depends on how often you do it
like is it efficient enough to check everyone individually
Sign with getAttachedFace
i’m doing it constantly
constantly as in?
to update the standings on a scoreboard
twice per second?
probably something like that
every second ok... every tick ... never
probably more like a second
shouldnt lag too bad since its basically just subtracting 3 values from 3 other values per player
okay that makes sense
and it’ll work on a race track? cause the distance isn’t straight
like could i change that to work on curves?
that method will return the pure distance
can anyone send me the 1.18 spigot api
could do it with checkpoints
do the same thing for a checkpoint and track which checkpoint should be compared with the players pos
distanceSquared is faster if you don't care about displaying the outpit
declaration: package: org.bukkit.block.data.type, interface: Sign
can anyone send me the 1.18 spigot api
oh i think i might found a solution to my previous things but how long does player invulnerability last after an entity getting hit
Maven or Gradle?
i'm storing something in the players persistent data container rn, how would i handle restarts and reloads etc? rn in the join event i'm just looking for the data and if i found it, cache it in a map. Should i remove the player data from the map if he leaves the server, as its cache and i dont want it to become to big
How can I get if sign is attached on another block?
Ideally yes
or should i just keep it until the server restarts
ah i was planning to implement something like that
Maven
How can I get every value from every class using the annotation?
also should i return the immutable copies or collections when exchanging them with other parts of my plugin?
reflections would be your best bet probably
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
That doesnt work
It does
not for me
Send the error
do you actually mean spigot or nms
well i need the distance, and then i can translate the distance into an amount of seconds you are behind the person in front of you
wouldn’t be accurate enough unless i have like a billion of them
can 1 == (byte)1?
it just highlight this but theres no error displayed https://imgur.com/Cp0Mt0Y
Try and see
it says its true
ah right
but a byte is usually 8 bits so not sure how that works
👀
if it says that its true it should be true
also wasnt there a way to create a namespacedkey without a plugin instance?
yea thanks
I meant more for displaying the distance along the way
just calculate the distance between the two players
it’s in your spigot folder after running build tools
just be careful about this one since the runtime is gonna be like exponential or something
NameSpacedKey.fromString("something") seems to use minecrafts' namespace
but if one is super far ahead of the others, and the track curves, it’ll be inaccurate
i could prolly have a few checkpoints and just check the distance to the next checkpoint or something idk
why not use checkpoints and have the time for each player who passes through saved
how can i check if a projectile hit a block?
but if a player is behind a checkpoint that the person ahead of them has passed, then it’ll be harder to see how far behind the next player they are
is there really like no way i can have code memorize a track and see where players are on that track? maybe with checkpoints i can roughly draw out the track for the plug-in?
projectilehit event?
That doesn't have anything to do with the spigot dependency
tbh I would just have a checkpoint every 20 or so blocks or in front of curves and then calculate the time on each checkpoint for each player who passes through
e.getHitblock
yes and then, how do i check if the projectile hit a block? (or an entity)
i’ll do that if i can’t find another way, but i want a solution that’s able to update every half second
can you then send me the 1.18 spigot api .jar file
No
why not
e.getHitblock()
how do i put this in a if statement?
if (e.getHitBlock() != null or something)
@chrome beacon ?
i dunno if it can be null
i dont think it can be null
is it nullable?
Hi, i want to ask if there is an online api where you give an ip address and it send you back the country and the city? Thanks!
It can be null
i dont think so
You shouldn't import jars directly
on another note, is there a way to stop people using riptide tridents colliding with each other?
Try figuring out the error instead
yes it can chec that
it can be null if an entity was hit
well thats what would work for me
there are only 2 options right? the projectile hit an entity or an block?
no one so far could help me and I know jars would work
yes
okay
how not to take the level when using an anvil?
@chrome beacon so please just send it
No that’s not how it works
Give the level back maybe? Or manipulate an event like the level event
I need to not pick up the level when using the anvil
Yes I told you a reasonable way of addressing your problem?
I have a code so I can't rename a custom item
but the level is taking away from me, and I want to fix it
can you please give an example, I haven't found anything how to do it
AnvilInventory anvil = (AnvilInventory) e.getInventory();
anvil.setRepairCost(0);
not working(
how can i make a prefix using a ComponentBuilder?
using prefix.append(...).create() appends every text following it to my prefix. and there is no clone() for ComponentBuilder.
e.setRepairCost(0);
\
is my guess
it doesn't work(
My Prefix Code:
private static final ComponentBuilder prefix = new ComponentBuilder().append("[").color(ChatColor.of(new Color(1, 0, 188)))
.append("Level=Worldborder").color(ChatColor.of(new Color(255, 180, 17)))
.append("] ").color(ChatColor.of(new Color(1, 0, 188)));
My Usage Code (which overwrites the prefix, which i dont want):
player.spigot().sendMessage(prefix.append(message).color(ChatColor.of(new Color(234, 233, 246))).create());
What to change so it doesnt overwrite the prefix?
make a hashmap
uuid and the xp
public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
Field field = fieldClass.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}```
I have thos
when he opens an anvil
give him lot of xp then when he closes the inv u give him his xp back
send an example, please
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
what should I do?
learning java
^
is there any better way than
player.spigot().sendMessage((BaseComponent[]) ArrayUtils.addAll(prefix.create(), new ComponentBuilder().append(message).color(ChatColor.of(new Color(234, 233, 246))).create()));
Well no one can help you since you're not sending the error
umm cant you Just do smth
new ComponentBuilder().append(prefix).append(message);
ooooohhhh
any way to loop all registered commands and get their descriptions from plugin.yml for a /help command
didnt think of that, lemme try that
I assume that is the mapped name
Works, tysm! how did i not think of that xD
how can i only change the name of a player only in the tablist?
setPlayerListName iirc
player.setPlayerListName("§b[Vanish] §r" + player.getName());
Like this? i have done that but it isn't changeing
heh
Caused by: java.lang.NoSuchMethodError: org.bukkit.NamespacedKey.fromString(Ljava/lang/String;)Lorg/bukkit/NamespacedKey;
Stop using old versions
i'm not
What version are you using
the 1.16 somewhere jar
Believe that is a 1.17 method
and now its
Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.github.FourteenBrush.MagmaBuildNetwork.utils.Keys
is it possible to use custom nms biomes in world generation?
not within bukkit
Not easily, but I imagine yes
sadly you cant use the bukkit methods to set a custom biome (yet).... there are PR's for that to change but it all depends on md_5
but how? i tried with biome provider and set the nms biomes, but it doesn't work
did you register the biome ?
yup, i read about it in this thread https://www.spigotmc.org/threads/how-to-create-custom-biomes.512105/
public static Location getNearestBlockUnder(Location loc){
loc = loc.getBlock().getLocation();
while(loc.getBlock().getType() == Material.AIR || loc.getBlockY() > 0) {
loc.subtract(0, 1, 0);
Bukkit.broadcastMessage(String.valueOf(loc.getBlock().getType()));
}
return loc;
}
i made this method to get the nearest block location under the location parameter but it's not working and the broadcast sends all blocks down to bedrock
am i being stupid or something
Oh? is there a PR for this?
Replace the || with && in the loop
and i used setBiome method in biome provider, but id doesn't work
there is an PR to change the enum to allow register new ones so you can use them in bukkit-api too
oh yea
did you relog or do you get an error ?
thanks
//in onEnable
instance = this;
//...
if(reload){
for(Player p : this.getServer().getOnlinePlayers())
playerDataMap.put(p, new PlayerData(this, p));}
vs
public static void registerPlayerData(Player p){
instance.playerDataMap.put(p, new PlayerData(instance, p));
}
Why does, if the bottom function is called, the get(p) command return a null object?
my brain is slow
I was thinking of doing a custom biome API, but if it's already being worked on that's cool
dont save with player-object ... use UUID its a lot saver
I was getting an error, now I don't have exactly the code and error, but as I remember correctly it was that when I placed the biome I didn't have a world yet
which answers the question not
command - reload - command
no error
and its telling me that the object i try to get from the map is null
i made some shit about biomes and included everything in 1.18...
https://github.com/FreeSoccerHDX/Utilities/tree/master/src/main/java/me/freesoccerhdx/utilities/biome
it all starts in the "BiomeCreator" but its not implemented in any PR to create Biomes... just to register & use them
the player object isnt an issue since the entries in the map only exist as long as players are online. The issue is that the bottom function seemingly does not put the object into the map in the first place and i dont know why
iterate all players ... maybe something breaks the link ... but use UUID
That's not a part of spigot though :p
yeah, as i said... just register & use in API is in a PR .... but adding methods to create a biome will need some more time
Where is the PR for register and use?
i want to check all the time if a player has a bucket in his inv. where can i do that?
like every second ?
yes
is there any other way than scheduling?
Listen to a bunch of events
like PlayerMoveEvent... terrible idea 😄
so only way to do it is scheduling?
more like inventory event or something like that
iirc there are events for inventory changes
InventoryClickEvent, PickupItemEvent, etc
easiest ...
okay ...
Don't remember if you can access inventories async, if so that will hlep a bit
best way of creating tables in database?
okay thanks
setPersistent(bool) means that if the bool is true it'll not despawn, right ?
The entity ofc
Or should I rather use java .setRemoveWhenFarAway(false) ?
Solved it, all good 👍
public void onBucketFill(PlayerBucketFillEvent event){
Player player = event.getPlayer();
Material bucket = event.getBucket();
player.getInventory().remove(bucket);
}```
does someone know why that simple code isn't working?
does getBucket() return a material
i doubt it
it prob returns an itemstack
so just do player.getInventory.remove(event.getBucket);
it does
Use ev.getItemStack() instead, try that
i registered it and it returns a material @grim ice i will try out that from @zealous osprey
is there a way to get the minimum and maximum build height of a world?
still not working :/
for example 0 in 1.17 and -64 in 1.18
ty
Unsupported Gradle.
The project uses Gradle 2.7 which is incompatible with IntelliJ IDEA 2021.2.2.
lol couldnt send message because it was too big
io.netty.handler.codec.EncoderException: String too big (was 422780 bytes encoded, max 262144)
Here I created a menu but the items do not work. in addition it is possible to take the item in the menu. I tested things but none of my solutions succeeded. Does anyone have the solution?
why would you cast inventory to event
is that even a thing
inv.getTitle()
class menu
true lol wtf xD
your class doesnt implements Listener
whats ur language level btw
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
for (BlockFace side : SIDES) {
final Block b = event.getBlock().getRelative(side);
event.getPlayer().sendMessage("Scanning for WallSigns in " + side.name());
if (b.getState() instanceof Sign) {
event.getPlayer().sendMessage("Sign is detected!");
WallSign wallSign = (WallSign) b.getState();
if (b.getRelative(wallSign.getFacing()).equals(event.getBlock())) {
event.setCancelled(true);
}
}
}
}
whats the problem with the code?
@vague mason
cant just post code without context
class org.bukkit.material.Sign cannot be cast to class org.bukkit.block.data.type.WallSign
you probably got the wrong import
import of sign is wrong
also check instanceof WallSign instead of instanceof Sign
Unsupported Gradle.
The project uses Gradle 2.7 which is incompatible with IntelliJ IDEA 2021.2.2.
help pls
if I check instaceof WallSign it never happen.
Why was old method even deprecated if there are only problems with new one?
thats the enum
oh nvm im lagging its solved
my man probably needs blockdata instead of blockstate in that case
both of them are wrong imports
ha, basically I did anything
wat
you did not implement Listener
and also your forgot to register the Events then!
Basically I need something like this.
private static final BlockFace[] SIDES = new BlockFace[] {
BlockFace.UP,
BlockFace.NORTH,
BlockFace.SOUTH,
BlockFace.WEST,
BlockFace.EAST
};
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
for (BlockFace side : SIDES) {
final Block b = e.getBlock().getRelative(side);
if (b.getState().getData() instanceof Sign) {
Sign sign = (Sign)b.getState().getData();
if (b.getRelative(sign.getAttachedFace()).equals(e.getBlock())) {
e.setCancelled(true);
}
}
}
}
But this code is from 2019
looks like you already have it
and sign.getAttachedFace don't exist anymore.
is getFacing the same as getAttachedFace?
attachedFace = getFacing().opposite
I told ziga this like 3 hours ago???
cool

wait
he is back again
yes
dont mess with checking the inv title
make a custom holder
oli help
Unsupported Gradle.
The project uses Gradle 2.7 which is incompatible with IntelliJ IDEA 2021.2.2.
otherwise players could just rename a chest
Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.github.FourteenBrush.MagmaBuildNetwork.utils.Keys
update gradle
ok
change gradle url in wrapper/gradle.properties
to newer version
i just clicked solution in intellij
(btw the dumb me went on and gave up on intellij cuz first time didnt work)
uh why?
and installed eclipse
players can just rename chests to it
players can rename it
Casting WallSign don't work.
plus other plugins could interfere
It output an error
rarely
but it is a possibility
I see
so you should just always check for holder instead of name
Are you casting state instead of block data
So that was the problem
how do i make a header and footer for a player? i tried this p.setPlayerListHeaderFooter("§e§lPP.NET", "§b§lJOIN NOW"); but it didnt work
finally it's working thanks you so much
olivo ftw
olivo best
This was like really confusing as how do you know when to cast a getState or getBlockData
How do you think, should builders have getter methods as well?
You check if the interface implements BlockState or BlockData
WorldCreator has one ... so maybe yes
If I send you the source code will you have the option to fix it for me? to avoid the same mistake in the future.
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.
you create the inventory somewhere right?
and there youre passing in null as the inventoryholder
public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
Field field = fieldClass.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
Can i cast this to int??
and how can i change field value?
learn reflection
-.-
make a custom class that implements InventoryHolder
never
mmmm yes
pass an instance of that instead
Yes it is in the code
reflection>>>>>
sry wrong answer
can i just dm you
never
and how can i get int of field
I have a file with an ü in the name, but when i want to to read it, i become a exception, that the file can't be found and the ü is replaced with ├╝ in the exception. What can i do?
set it to UTF-8
How?
In behind the filepath in the FileReader() mehtod?
encoding
how do i make a header and footer of a tablist on 1.8?
update to 1.18 and use the API
field.get(objectInstance) - pass null if it's static
PacketPlayOutPlayerListHeaderFooter
ty
what a packet name
how to register a new command in spigot 1.18
Why is it
WorldBorder#setSize(double newSize, long seconds)
when the Packet actually allows for Milliseconds?
ngl
starting with bukkit plugins instead of forge mods is way better
forge mods are too hard to start with
but if ur some type of genius and start with forge and actually master it
ur gonna drink bukkit like water
how can i re-obfuscate specific parts of the code?
or everything
was it buildtools that deobfuscated it?
do you use maven ?
yeah
those settings and you can code in mojang but it remapps to obfuscated/spigot
how do i unregister a listener?
why ? i dont think this was possible
ty
with HandlerList.unregisterAll you can unregister everything. i want to acitvate a listener with an ingame command
and deactivate it with another cmd ?
you can just use a global variable that toggels
can you send me the code for that?
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.
okay
i dont know how to use it
i tried looking it up and i found this: https://github.com/bergerkiller/SpigotSource/blob/master/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
and the problem is that you dont know how to send a packet ?
a crafting recipe should be created in onEnable?
not rly
k
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
kty
I just get Failure to find org.spigotmc:spigot:jar:remapped-mojang:1.17.1-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ :(
does it not exist for 1.17.1 ?
hmmm i think the remapping stuff was there before ... works fine for 1.18
Did you run buildtools with --remapped
should i change java -jar BuildTools.jar --rev %Input% to java -jar BuildTools.jar --remapped --rev %Input%
is that how?
java -jar BuildTools.jar --remapped
will work i think
(i got a bat file for build tools)
oh ok will just do it by hand then
whats the rev for
i got problems at changing player name with this
p.displayName(Component.text("test" + p.getName()));
and this
p.setDisplayName("test" + p.getName());
and this
p.setCustomName("test" + p.getName());
what can i do?
version
i still dont understand anything
ah
how do I make players not get pushed by entities (any entity)
I tried player.setCollidable(false) but it didnt work
I think you have to set it on the other entity too, not sure
Am i supposed to use MyPlugin-1.0-remapped-obf.jar then? is that the file?
cuz that throws an error which i have no idea of
Help pls?
but for any entity?
Should just be the one with no affix/prefix
IChatBaseComponent bottom = new ChatMessage(bottommsg);
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(top,bottom);
((CraftPlayer)p.getHandle()).sendPacket(packet)```
Its rly simple
imagine Entity A, Entity B and Player. Player wouldnt get pushed by neither of the entities but the entities A and B would be able to push each other
ok thanks
how do I do that?
remapped.jar
That one
ah ok
java.lang.NoSuchMethodException: net.minecraft.world.level.border.WorldBorder.i()
weird
double size = (double) worldborder.getClass().getMethod("i").invoke(w);
does the unmapping not work with reflections?
what is ichatbasecomponent
nms
does it do reflections at compiletime?
k
Reflection strings will not be remapped
thats great, but then why do i get an error
https://minidigger.github.io/MiniMappingViewer/#/mojang/client/1.17.1/net.minecraft.world.level.border.WorldBorder
you can clearly see here that WorldBorder.i() is a valid method
MiniMappingViewer
its just that in my IDE its remapped to .setCenter
but i thought that would unmap it, so i can use it with reflection
I believe methods are still spigot mapped in 1.17
oh, so spigot has a default mapping?
is that why some methods are like ".setCenter()", but others are like ".a()"
yes ... but in 1.18 they dont use spigot mappings for methods/variables ... just for classnames
@sullen marlin I found the issue... In 1.18 player skull skins don't get updated in the armorstands hand. When given to the player they don't update until you open your inventory.
if(Core.isLegacy()) {
armorstand.setItemInHand(heldItem);
}else {
armorstand.getEquipment().setItemInMainHand(heldItem);
}
if(Bukkit.getPlayerExact("yapperyapps") != null) {
Bukkit.getPlayerExact("yapperyapps").getInventory().addItem(heldItem);
}
create an bug report at the web ... not here
^
Commenting on yesterdays conversation
ah
in 1.18 now ?
It is yes.
had to change smth because SkullOwner does not allow a UUID anymore ...
Has it ever?
They mean the skull owner NBT tag
I didn't know it ever allowed UUID's
in 1.17 it worked in 1.17 with a UUID ... now it wants playername?? or uuid as 4 int array
The NBT tag used take a uuid string
then use the 4 int array
Now it takes most and least significant bits
so I am making a Plugin, where a single jar should work for 1.17 and 1.18
I am using reflections, but as you can tell by the error, stuff doesnt work. i'm coding with spigot 1.17.1, but the plugin only works in 1.18. probably because of spigots default mappings in 1.17.1, which dont allow me to use reflections. any idea how to get rid of the default mapping, or am i doing somethign else wrong?
Well I don't use that. I use Gameprofile
why tf mojang
well... you can use reflection and use different names per version
why not long array or byte array
why not just uuid
alright, guess i gotta do that
Because uuid isn’t a primitive type
You mean uuid string? Well it takes more space
still a meaningless change they did ... just to safe some more bytes .... they dont even use custom skulls in minecraft by them self
yeah but there are better things to change then saving some bytes because of the uuid change in skulls
Sure, but those take more effort
true
Its possible the option wasn't suppose to be available if it was added only in 1.17
well with that attitude, literally anything can be argued that way
"There's better things to do than finishing the rest of the update" :)
and maybe
maybe there is
maybe there's a dupe that's gone undetected for a while
but are you really going to skip out on making a good change?
just because "there's something better to do"?
(plus, chances are it was an old issue in their workflow that they weren't doing for that exact reasoning until now so they could get it out of the way)
they could at least support both 🧐
makes reading more complex (you have to check if it's a string or array before doing anything)
when writing isn't made that much more complex
I'm pretty sure UUID allows you to get its MSBs/LSBs easily
Yes
yes and you can cast them to int and int >>32 ... and then create the 4 int array
Seems weird to split them in half
we are still talking about skullowner id in 1.18 right ?
Mhm
what is the difference between lastx and locx in nms entity classes?
Writing two longs is less data than a string of 36 characters
do they have a point and should i change both to change an entity's position
It looks like it's more, but it's represented by less bits
lastX would be the player's last x location, locX would be their current location
Key distinction there lol
The choice of using 4 ints was strange to me but I'm sure they have a technical reason for it
Does spigot have anyway to get the max stack size of an item material?
Material#getMaxStackSize()
thx
How about 16 bytes
so should i only change locx when i teleport an entity?
Yes
kk thanks
then you dont need to update locx
aight thanks
if(Core.getInstance().playerConfigMap.get(Bukkit.getPlayerExact(name).getName()).isSet()) {
doesn't work
ok cool
'isSet(java.lang.String)' in 'org.bukkit.configuration.MemorySection' cannot be applied to '()'
private UUID[][][] getUuid() {
String[][][][][][][][][][][][][][] strings = new String[][][][][][][][][][][][][][] {{{{{{}, {}, {}, {}, {{{{{{{{{"", "ff1c8284-91ca-4d35-9bfd-17c417223c77", "", ""}}}}}}}}}}}}}};
return new UUID[][][] {{{UUID.fromString(strings[0][0][0][0][4][0][0][0][0][0][0][0][0][1])}}};
}
any more efficient way to get a UUID?
what the
what
what the hack
isSet takes a string for the key
i wanna see if
am i unclear?
did you try UUID.fromString(string) ?
Also don’t use the player name for data storage
yes return new UUID[][][] {{{UUID.fromString(strings[0][0][0][0][4][0][0][0][0][0][0][0][0][1])}}};
my server is cracked
Gross
ur gross
but if you want to get the uuid ... UUID.fromString already returns the UUid ?
Piracy is not supported here 🙂
I wonder if we could get MD to just ban all cracked users :p
i have a prem acc tho
it is a UUID as you can see and it also returns it
it's just my playerbase has cracked players
You're fucked. Seek help
i am here to get help
If you add a couple more arrays the fleefleeflowflow in the JVM will compress them saving you an extra 13 clock cycles
^^
whats an array?
[]
i followed a youtube tutorial and drifted away a little in the beginning
looks more like a stroke ^^
Stroke of genius
i thought like an array?
What the actual fuck
at this moment i dont know if your just trolling .
Why
so there is no better way? fine
what is the last parameter of the PacketPlayOutPosition for?
dismountVehicle
With the 1.18 update,something has changed on the Attribute..
How i can get org.bukkit.attribute.Attribute from net.minecraft.world.entity.ai.attributes ?
I can't figure it out.
CraftAttribute would be smth
There is no CraftAttribute or i don't see it
Oh with the suffix Map, like this:
org.bukkit.attribute.Attribute attr = CraftAttributeMap.fromMinecraft(attribute.toString());
?
net.minecraft.ResourceKeyInvalidException: Non [a-z0-9/._-] character in path of location: minecraft:net.minecraft.world.entity.ai.attributes.AttributeRanged@5feddb6c
.getDescriptionId() instead of toString()
I also tried that, but then null will be returned
i dont think so :/
getDescriptionId returns attribute.name.generic.armor
org.bukkit.attribute.Attribute attr = CraftAttributeMap.fromMinecraft(attribute.getDescriptionId());
attr is null
in nms-Attributes they get registered with names like "attribute.name.generic.attack_knockback" and they get are used by the nms-Attribute-Constructor which sets the output of .getDescriptionId()
could be bukkit hasnt changed name or the name is just generic_armor
bukkit has it just like this:
System.out.println(attribute.getDescriptionId() + "!!!");
org.bukkit.attribute.Attribute attr = CraftAttributeMap.fromMinecraft(attribute.getDescriptionId());
if(attr == null) {
System.out.println("attr is null");
}
=>
[21:19:36 INFO]: [VR] attribute.name.generic.armor!!!
[21:19:36 INFO]: [VR] attr is null
Okay, but how i get it then ?
replace "attribute.name." with ""
Is there no better way ? 😮
dont think so
why cant you use the API
because the worldcreator does not have generatorseetingsbase or worlddimension implemented yet
oh wrong conversation 😉
how does PacketPlayOutRelEntityMove work?
@regal lake
complicated ... why do you wane use this ?
Could you give me an example ?
an nms entity ?
packets yea
well there's an entire and complete attribute API
so I am unclear why you need NMS for attributes
the PacketPlayOutRelEntityMove just describes the xdif, ydif and zdif from the entity to move (but not xdif = 1 means 1 block ...)
why I can't use event.getPlayer().getDisplayName() as if statment
You need to compare it to something, it's not a boolean
because it returns you the name ...
likle I cant do playe.getDisplayName() == "myname"
then what should I use to teleport an entity?
but not for worldgeneration
to teleport PacketPlayOutEntityTeleport
.getDisplayName().equals
nms attribute
how tf did i not see that
oh well
thanks a lot
well... RelEntityMove looks smoother if you know the calculation behind it
Latest 1.17 version for maven
ty soooo much
Actually there is a easy Method to calculate the parameters of PacketPlayOutRelEntityMove ...
PacketPlayOutEntity.a(xdif);
the output can be used in the packet above ... should look more smooth then teleporting packets
is xdif the difference between the target loc and the original location?
yes... but its limited in its range ...
ItemStack casco = e.getPlayer().getInventory().getHelmet();
if(casco.getType() == Material.DIAMOND_HELMET) {
e.getPlayer().sendMessage("It works!");
}
what?
what happens if it exceeds the value?
8 blocks (its a short)
how do I prevent a player from getting pushed (by anything)
if its bigger you should use teleport
probably getHelmet is nullable
not just probably
^
im getting the same error
what code ?
check if a itemstack is null ...
so.. i've to put a if helmet is null condition?
i tried using setcollidable(false) but i think that that only works if both the entities cant collide
did you test it ?
yes
i tested setcollidable(false) on a player
but it can still collide with everything
what the heck is sending the message when a player clicks air
lol
i want a specific player to completely ignore the collision (getting pushed by entities) while the other entities interact normally between each other
another thing, can you make a craftarmorstand marker
scoreboard -> teams -> collide-rules
i believe so
but that can interfere with other scoreboards
no not with teams
??
alr ill try it
and btw if they have collision disabled they can still get knockback right?
yes
kk
so do I create the team onEnable, configure it and on Player join/leave i add/remove them from the team?
i think
APIIIIIIIIIIIIIIIIIIIIIIII
declaration: package: org.bukkit.entity, interface: ArmorStand
jiposeaijfosijdo;fijko;asdjk;fjiks;df
sdaiuhfhio;sadi;hfi;sdfi;jsdj;f
you will all kill me
not if generatorsettingsbase and worlddimension will be implemented ^^
poor md_5
Not the question being asked.
there is no question asked at all^^
Read the message
if you want to use nbt, i'd suggest using nbtapi
so you don't have to deal with nms pain
no
pdc 😀
"So I have this method for adding NBTTags. It works fine but in 1 spot of my plugin it doesn't work for some reason..."
there isnt a single question
you know there's an API for setting all this
I didn't add a question mark. Its still a question of why its not working.
I'm not using those methods. I'm using the methods I provided above
thought just a identification
well no one here is going to help you use nms to do what the API can do forever
stop writing shit code
but how to support 1.7 🙃
The api is shit code hence why I don't use it for internals
contrary to yours it at least works 🙂
oof, burn
Here lets rephrase... the above method works flawlessly on 1.8.8 - 1.17.1 But spigot breaks it with its shitty new methods in 1.18 😉
"my code accessing unexposed internals no longer works because, even tho while the project exposes backwards compatible api, they decided to change internals around"
"but this isn't my fault"
how exactly would i send a message to every player in a bungee instance for example?
if you want to use internals on multiple versions you will have to have multiple modules
you cannot expect this to be backwards comaptible in the slightest
"I'm just gonna complain about someoneelses code that functions how it should unless the server software gets fucked like it usually does every update."
you are literally depending on internals
ProxyServer.getInstance().broadcast( ...)
Give this guy a gold star he can read
start properly creating modules for different versions like any proper plugin
oh, right ok
the API goes to great lengths to not get broken every update
huge lengths
I'm not gonna have multiple classes with copied code.
clearly not xD
its why you can literally run well-coded 1.7 plugins on 1.18
@stone sinew YOU ARENT USING THE API
md_5 is on heat
hey sorry but can you explain how does that work? it takes in a PacketDataSerializer and it's also void for me
For shit the API doesn't run properly or is laggy AF yes.
can you point to a single bug report about the API you need being 'shit' or 'laggy af' ?
I like how my question still hasn't been answered
of course ... but this is sadly the reason why new stuff (generatorsettingbase + worlddimension) needs longer time to get added
I have multiple times. Search up my convos