#help-development
1 messages Ā· Page 986 of 1
Waiting for Java's introduction of it š¤
But it isn't valid, it is ill-formed
Just compile it and see
the program very much compiles
Not LTS, doesnāt count
You don't count >:(
I can count to at least 7
Wait coll cant count?
$ is supported as an extension by all compilers
For something non-enterprise this is good
If you want to go crazy and overengineer I'd make an account provider thing
The only reason your C++ snippet won't compile is because the lambda doesn't return a pointer, but stick a return 0 inside the {} and you're good
Fizzbuzz
wdym by account provider thing?
Or use a different compiler that defaults to a return 0 and it'd probably be fine too
Threw it into an online compiler, works fine
So
ĀÆ_(ć)_/ĀÆ
This part does not scale if you want to add more account types
inb4 Janitor account
lol
bro hasn't ever heard of lambdas and thinks I don't know basics
this is baffling
yeah maybe an admin account too
What you can do instead is some kind of account registry, where you match characters / inputs to new accounts depending on the input
just compile it you'll see š
My brain is trying to comprehend what that code actually does
I just did and it does :)
Also did and did
clearly you didn't compile it hard enough
what would something like that look like? thats a new concept to me
COMPILE HARDER >:((((
COMPILE HARDER IT WILL BREAK
Show me
lmao
I want my own choco
bro you just need a better compiler
Itās an int named _ thatās assigned to be⦠something
G++ is where its at
Nats I showed you it compiled above D:
why don't you do it and see for yourself?
Instead of "If this is S it's a student" we can stay "S stands for Student and it maps out to a new instance of Student"
M++
I assume you know the basics of what an interface is, given you have a User one
ohhh okay i think i see what you're saying
What if you made an interface that's responsible for creating users
Sorry M++#++Ć#-++#
Map<String, UserFactory> šŖ
actually i didnt use an interface š
but thanks for bringing that up cuz that would make a lot more sense
Pretty much
Yeah I compiled it with gcc and you don't need the return statement :p I figured it was a compiler thing
what i did was actually User is an object, and student/librarian extends it
compiled with clang and it builds fine
I was just using a shitty online compiler so it's probably using some off the shelf one
Or maybe an out of date compiler
public interface UserFactory {
User createUser();
}
Whatās gcc stand for
gcc just warns instead of errors out so it might fail if you were more strict on it, but even still, all you need is a return in there
Garbage collector collector?
Google code compiler
ā ~ cat test.cc
int main() {
typedef int $;
$ _ = ~!+[]()->$*{}();
return 0;
}
ā ~ clang++ test.cc -o out.a
test.cc:3:21: warning: non-void lambda does not return a value [-Wreturn-type]
3 | $ _ = ~!+[]()->$*{}();
| ^
1 warning generated.
ā ~
šŖ
Thats why I love C++ ā„ļø
go learn lambdas
suits me
Probably deserved it
hm, im still confused on how i would implement this into the rest of the code
I said skript was for babies and I still stand by that opinion
Im making eclipse check if the user acc name is hawke to make all warnings errors
Now if you'll excuse me... I'm going to get a cotton candy blizzard 
We create an instance of our user factory for each account type
Order me one too
Whose implementation returns an instance of that account
cope harder
I dont really remember how the situation was with Java versions in spigot plugins, would JDK 21 suffice or should I downgrade to 17?
1 mistake in my lifeee
The only valid use i see for skript is a command that literally just sends text back
I barely remember some compatibility issues but its very vague
Java has this neat thing called lambdas, they're basically short interface implementations
alright ill just use 21 then
public class StudentUserFactory implements UserFactory {
@Override
public User createUser() {
return new Student();
}
}
can also be represented as
() -> new Student()
or
Student::new
Im surprised that @eternal night music choice is actually good
the fuck
So what if we made something like
Map<String, UserFactory> userFactories = Map.of(
"S", Student::new,
"L", Librarian::new,
"A", Admin::new,
"J", Janitor::new
);
...
this is #help-development, please use the correct channels epic
And that way we can grab the correct user factory based on the user's input and create the user without caring about implementation details
But why use a userfactory instead of just creating a new "Librarian" or new "Student"
Indeed I do xD
so does everyone with an iq above room temperature
šŖ
You want a new user object, not to reuse the same old one
Does MD support it

The user factory does exactly that, creates a user every time you call the method
Aka did Y2K just say MDs IQ is below room temperature
The implementation of UserFactory is what decides on what kind of user is created
Could you help me see this implemented into the rest of the code?
If it isnt too much to ask
welp I'm banned had a nice run
Sure, let's create some kind of class responsible for creating users
Where we toss our map and all of that
Okay, do you want to see my original user class?
No need
Although tbf summer just ended in Australia so room temperature was probably pretty high
lets post my spigot stats before I get banned like. Amount of fuck's said times warned by staff etc
Well ājust endedā
public class UserManager {
private final Map<String, UserFactory> factories = Map.of(
"L", Librarian::new,
"S", Student::new
};
@Nullable
public User createUser(String input) {
if(input == null || input.isEmpty()) {
return null;
}
String start = input.substring(0, 1).toUpperCase(Locale.ROOT);
UserFactory factory = this.factories.get(start);
if(factory == null) { // Invalid input
return null;
}
return factory.createUser();
}
}
I'd recommend using some kind of user type enum or string instead of this but whatever
If you don't care about expandability or hooking in 3rd party users you can skip this and replace with an enum, something like
public enum UserType {
LIBRARIAN("L", Librarian::new),
STUDENT("S", Student::new),
;
private final String label;
private final UserFactory factory;
UserType(String label, UserFactory factory) {
this.label = label;
this.factory = factory;
}
public User createUser() {
return this.factory.createUser();
}
public static UserType getByLabel(String input) {
// pretty much same as above
}
}
With the top approach you just call userManager.createUser and if it's null the input is invalid
With the bottom approach you call UserType.getByLabel and if that's not null you then call createUser
Both are valid options, one is open and expandable and the other one is a bit tidier
Top approach, but it needs more work
Bottom approach is expandable in the sense you can add more users
Top approach is expandable in the sense where you can have 3rd party programs add their user types by just registering a factory
You can't extend enums, but you can add to maps
Yeah
okay, i definitely have a lot of studying to do
Well teeeeecnically
it's still a bit confusing to me, but i'm starting to see the picture you're laying out
thank you!
He's picking up what you're putting down
Hi, anyone knows how can I fire a EntityChangeBlockEvent? I made a custom nms entity that can change/break blocks. Using block.setType(Material.AIR) works but doesn't call any event so plugins that log those types of event (like coreprotect) miss the interaction.
I saw the in the javadocs that it can be called like EntityChangeBlockEvent(Entity what, Block block,BlockData to) but I don't quite get how I could create a blockdata for a block when it is converting to AIR (being broken).
Material.AIR#createBlockData
Or you do it with the previous block, donāt remember which it is
Yeah it seems to be like that, but now:
block.setblockdata?
Sorry this may be obvious to you guys but it's my first time firing events...
How would you add food data to an item that isn't a food item?
I donāt think said event has any mutable properties
Thereās api for it now
ItemMeta has a get, set, and hasFood
Oh I see, getFood() will create a new CraftFoodComponent with empty FoodProperties if it doesn't exist. Was looking to create a FoodComponent and pass it into setFood lol
I dont know how much of an apropiate it is to ask for help here, but I have some big problems with my IDE on Linux
is your filesystem ok
flatpak or snap
yay
and if you do restart it?
Tried restarting os, IDE, updating both
Yes
do these errors pop up elsewhere
This one does 24/7
Every few seconds
This only when I try to build the project
are there any plugin updates
Has this IDE install ever worked?
is it possible to bundle a datapack inside of a plugin?
No. Would be neat, but no
is there an easy way to copy a folder or zip file from inside the jar to world/datapacks?
yes but that's not realistic
data packs load before plugins
oh, i didnt know that
when it comes to the server plugins are pretty much the last thing to load up
Yeah you have to deploy it and then either reload the datapacks, or for anything that canāt be reloaded you have to restart the server
imma see if /datapack enable works
Depends what is in it
Recipes, advancements, etc are ā
Biomes, structures, anything worldgen really are ā
it runs the load function
and this particiular datapack doesnt do worldgen stuff
so it works :)
what stuff can datapacks do plugins can't
Basically interacting with the registries
Registering custom biomes, for one
Plugins load way too late to be registering custom biomes
do it in teh plugins onLoad method
true
Thereās very little you canāt do in a plugin with enough effort
integrating someone else's large datapack without rewriting
Although java is working to change that :c
onRegistry when???
When you PR it
spigot should get initialization stages like fabric has (preLaunch, main, etc)
even datapacks allow you to specify to load before/after each other
It has stages, just not the ones you want
onLoad, onEnable, loadBefore and loadAfter
yeah, im talking about loading before/after certain parts of the server load
It would need to be loaded before the plugin's code loads
private static void createNine() {
ItemStack Nine2 = new ItemStack(Material.STICK);
ItemMeta meta = Nine2.getItemMeta();
meta.setDisplayName("§5Nine");
Nine2.setItemMeta(meta);
List<String> Desc = new ArrayList<>();
Desc.add("§7I got a new Stick");
List<String> Abil = new ArrayList<>();
Abil.add("§dSTICKS §5[§dRight Click§5]");
Abil.add(" §7Get a Stick");
ItemStack item;
item = ItemMaker(Nine2, 10D, 0D, 315D, 1D, 0.1,EquipmentSlot.HAND, false, Desc, Abil);
Nine = item;
ShapedRecipe SR =new ShapedRecipe(NamespacedKey.minecraft("Nine"), item);
SR.shape("SSS",
"SNS",
"SSS");
SR.setIngredient('S',Material.STICK);
SR.setIngredient('N',Material.NETHER_STAR);
Bukkit.getServer().addRecipe(SR);
}```
any1 know why the recipie doesn't work liek the item doesnt craft
Is there way to deep copy Map<String, Obejct>?
its cause the namespaced key had an uppercase mb
so after a little research, there is a datapack interface, but you can't enable datapacks from it
you can write a method for it
Can't you do shit like new HashMap<>(oldMap)
Ah
Gimme a sec
First result on google
https://stackoverflow.com/questions/28288546/how-to-copy-hashmap-not-shallow-copy-in-java
That's an interesting way to do that
use instead of it originalMap.getClass();
yeah well gson actually makes a copy for all
Wait, wtf is {}.getType()
it's a fancy gson thing to infer the generic type of an object
Ah okay
any dev that wanna work voluntary please dm me
Is they way to check when bee fill up beehive? I was looking for event or smtn and cannot find anything.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
after some research i found entityenterblockevent
Yea, but that will not tell me if it changed honey level probably
Its looks like when ever bee enter the hive with nectar it will change honey level so its solved, thanks. I basicly will change bees whole system. So I need only detect if bee add honey or not and I should be able to do that rn
Cant you just cast the Block to a beehive
And check the level
The Event has to have a block, right?
blockstate
Yea, but seams like it will have already modified block
Ye, that will do probably. Or just check if entyti have nectar and if ye, do what I need to do. If nop it should not change the honey level. That would make sens, hopefully
hi all
I will figurate out now what I need thats oke. Thanks guys.
anyone knows if 1.20.6 contains "obfuscation" changes compared to 1.20.5?
Btw. what is best practice to set inventoryHolder when creating custom inventory? I guess null will be better?
do NOT create custom inventory holders
so, use null
InventoryHolder interface is not meant to be implemented by plugins
Im making it this way. Is that wrong<
public abstract class PluginMenu implements InventoryHolder {
protected RealJobs plugin;
protected Inventory inv;
protected PlayerMenuUtility pMenuUtil;
protected Player owner;
protected ItemStack grayGlass;
public PluginMenu(RealJobs plugin, Player player) {
this.plugin = plugin;
this.pMenuUtil = plugin.getPlayerMenuUtility(player);
this.owner = pMenuUtil.getOwner();
this.grayGlass = new ItemBuilder(plugin, Material.GRAY_STAINED_GLASS_PANE).name(" ").make();
this.inv = Bukkit.createInventory(null, getRows()*9, TextUtils.format(getTitle()));
}
public abstract String getTitle();
public abstract int getRows();
public abstract void setMenuItems();
public abstract void handleMenu(InventoryClickEvent event);
public void open(Player player) {
setMenuItems();
player.openInventory(inv);
}
@Override
public Inventory getInventory() {
return inv;
}
}
that is not "wrong" per se, it's just not officially supported and it might break on the next update
if it works, it works ĀÆ_(ć)_/ĀÆ
oh, I get it. there is probably still not better way then implements InventoryHolder anyway
nah as said, you are not supposed to create a custom InvHolder in the first place - what do you do it for anyway? to detect your custom GUIs?
in those case, you should just save your own created inventories inside a List / Map / whatever and check if it contains(...) the currently checked instance
if you wanna save additional details for each inv, you could e.g. just use a Map<Inventory,YourAdditionalInventoryDataClass>
Yea, bcs Im basicly opening another inventory while chest is opened to change title of it. So I want to detect if it is rly chest or its custom inventory. I just added chceck when InventoryHolder is null not open that modified title inventory. There could be problem with some other plugins when I will just add that holder as custom inventory or smtn. But most of plugins will be custom anyway so will use null, so should be good
or this looks like solution as well, lol:
public static boolean isCustomInventory(Inventory inventory) {
return inventory.getHolder() == null || !inventory.getHolder().getClass().getPackageName().startsWith("org.bukkit.");
}
Hi, I am running under this exception when I try to install buildtools with version 1.8.8:
https://hastebin.skyra.pw/docarobeva.yaml
<3>WSL (9) ERROR: CreateProcessParseCommon:711: Failed to translate C:\Users\natha\dev\minecraft\BuildTools\Spigot
<3>WSL (9) ERROR: CreateProcessParseCommon:757: getpwuid(0) failed 2
Dk if this is the right place, but can anyone give me some resources or directions to learn anticheat development?
Really doubt theres any. Itās a pretty competitive thing people dont want to share
Someone did a forum thread about this and iirc you are recreating the whole inventory twice here
does anyone know a good way to determine the closest world direction (as in east, ... - a vector would also suffice) the player is looking in?
I don't wanna do the yaw comparison if statements four times
but that would probably be the most efficent way xd
something that might work is dividing the yaw by 90 and rounding taht down to get 0-3 for all four cardinal directions
sure u can do that too
but i feel like that would be way slower
i mean
it prolly doesnt matter cause both should be very fast
the alternative is
if (py >= 0 && py < 90 {
} else if (py >= 90 && < 180) {
...
ugly as hell
why not just put it into a util method
because I won't use this again
I see you doing a lot of really insignificant micro-optimisations, e.g. yesterday you were asking how to check a distance without doing square roots because square roots are "slow" (aka a few nanoseconds), it sounds as though you would get a lot more done by not thinking so much about tiny things like this.
if you wanna do it better for the hell of it sure no problem but just seems unecessary otherwise
insignificant micro-optimisations
??? this is not even my point
read that shit it's ugly as hell
same idea, micro-optimisation or the fact that your if-else statements are 'ugly'
You can't really rotate otherwise
If you want you can have an enum
And multiply using the enun
Have like EAST(1, -1
at this point it just seems unnecessary to add any complicated data type anywhere just for this one case
I'm just gonna leave it, knowing well that I will never touch that again
[12:46:11 WARN]: Horse (vehicle of dsfdfs) moved too quickly! -60.44958636915428,0.5,-9.90624406607077
[12:46:11 WARN]: Horse (vehicle of dsfdfs) moved too quickly! -60.44958636915428,0.4231679985046384,-9.90624406607077```
can this bypassed when messing with ``Move Vehicle`` packet
wdym "messing with"
basically faking a packet so it teleports the vehicle without yoinking the passengers
wait are you doing that clientside or something?
if you just send the client the packet without updating the position on the server that will happen
that's just how it works
because minecraft accounts for lag and stuff
that isnt minecraft's fault
that's from bukkit/spigot
the client handled it
((CraftPlayer)e.getPlayer()).getHandle().playerConnection.checkMovement = false; i found this
long story short i need nms
to do this
since i cant just disable it serverwide
unless i send like 4 move packets
this will greatly extend my limit without disabling it
is there any1 using redisson, that knows, why i cant set my RLiveObject inside of RLiveObject to null? The field doesnt set null :(
8 blocks maximum
it seems way more to me
it's like 10 according to my spigot.yml
8 is the limit before it expects a teleport
im trying to split it into parts
yep, extrapolate the movement
but i need to delay each packet, idk how much to delay it tho
actually, what exactly are you doing? as it seems you may not even need a Bukkit Entity
block the entity from entering certain areas
and teleport the entity sometimes
lets fucking go
i did it but it aint no smooth
Hi, is there a way to disable the red numbers in the scoreboard in 1.8?
no
in 1.20.3 yes
OK. and would it be possible to make an order that like openurl example /shop and that brings it back to my shop
Only if you click on a chat message https://www.spigotmc.org/wiki/the-chat-component-api/#events
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
screw vehicles
WOOO COMPONENTS
Why Im getting false? Block is BeeHive Im sure about that:
package me.marek2810.realjobs.events.listeners;
import org.bukkit.block.data.type.Beehive;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityEnterBlockEvent;
public class BeeHiveListener implements Listener {
@EventHandler
public void onBlockEnter(EntityEnterBlockEvent event) {
Entity entity = event.getEntity();
System.out.println(event.getBlock());
if (!(entity instanceof Bee bee)) return;
System.out.println("? " + (event.getBlock().getState() instanceof Beehive));
}
}
wrong Beehive import
the beehive BlockState is org.bukkit.block.Beehive, not org.bukkit.block.data.type.Beehive
hmm, but I cant get honez level from that org.bukkit.block.data.type.Beehive import, so I will need to get state and cast it to second import
getBlockData then
how would i make enchant glint dissapear on armor without removing the enchants? for example im wearing an armor thats all enchanted and i can see the glint, but other players wont see the enchantment glint. I know its possible with some packets magic
Clear the enchantments for the packet being sent to other players
enchantment_glint_override š
elaborate please
I was following this guy so š Im kinda confused why is state not working
whats that?
Whatās there to elaborate on
If the packet is being sent to a player other then the one wearing the armor
Clear all enchantments
1.20.5 added the ability to show/hide enchantment glint regardless of whether the item has enchantments or not
for the honey level you need the block data, that then is the correct import, but you need to use getBlockData instead of getState
is there in 1.20.5 the component system too?
wdym "the component system too"?
item components
yeah mojang moved away from representing itemstacks in memory as nbt and they moved to item components
whats the event i should listen for?
Uhh
is there a packetsendevent or something?
No
i suck with packets
Use a library like packetevents
hmmm
Well yeah but it would disable it for the player wearing it too
oh, I getting now... the method is in org.bukkit.block.data.type.Beehive witch is extended from BlockData not BlockState thats why, Im kinda confused why that person suggested BlockState but I will figurate that out. This check would be probably best and I can use import org.bukkit.block.data.type.Beehive import
if (! (event.getBlock().getBlockData() instanceof Beehive beehive) ) return;
looks good
can u hide player to a player without removing them from the tablist
and without invisibility
you could try hiding him and then adding him back to the tab list
how do u add someone to the tab list
with packets, maybe there is even api
that seems more complicated than just manually hiding the armor and considering the fact that using that method would most likely not be compatible with most plugins
only way to understand NMS is decompiling spigot jar and reading?
afaik thereās no javadoc
that would be even better
but the plugin is on 1.16.5
can u disbale camel dashing
without having a one tick timer that loops all camels...
whoās the (absolutely kind and funny person) who thought who that no javadoc and only remapping was good.
??
lol whoās gonna write a javadoc for something that isnāt api
u can have fun reading aa, ab, ac fields
bru absolutely not
i mean remapping is good, but reading each class to understand what to do gives you suicidal vibes
almost all classes start with Craft in craftbukkit which is already a huge portion, some classes end with it not start
so just search what u need and look into it through intellij idea
which packet do i listen for?
nms has hundreds of classes so reading all of them isn't really possible (unless u really hate urself) and some classes are thousands of lines like CraftPlayer which is alone 2k lines not including what it extends. u dont have to understand all of nms
Avoid NMS at all costs. Always API unless there is no other way
or jsut use protocollib
using nms for something that isn't packets is just straight up dumb
@eternal oxide do you know how i would remove enchantment glint from armor without removing its enchants? im in 1.16.5 tho
i know
PacketType.Play.Server.ENTITY_EQUIPMENT listen for this if u use protocollib and im not sure what the nms one is
There is a tag you can add to hide enchantyment glow
I can't update my spigot using buildtools.jar
well it is possible, and doesn't take all that long
nope
mostly just need to look at methods more then just every piece of code
thanks
nms changes every minor update
not by much
some of us here have basically memorized the implementation of MC
not really necessary, only need to look at what changed
not hard to do if you know how to do code comparisons
or just read the part ur working with
if ur working with CraftPlayer for example why would you read something like CraftPaining
or that, but that isn't what you stated earlier. In general yes that is all you really need to do in regards to what your project requires.
Pair<EnumWrappers.ItemSlot, ItemStack> pair = packet.getSlotStackPairLists().read(0)
.get(0);
EnumWrappers.ItemSlot slot = pair.getFirst();
ItemStack item = pair.getSecond().clone();
if (slot != EnumWrappers.ItemSlot.MAINHAND && slot != EnumWrappers.ItemSlot.OFFHAND) {
item.editMeta(ItemMeta::removeEnchantments);
pair.setSecond(item);
packet.getSlotStackPairLists().write(0, Collections.singletonList(pair));
}```
something like this should work
oh god
hi guys i have a big problem on spigotmc.org
I have the problem that files are larger or smaller than specified on the download button.
This means that some plugins have problems.
I also experienced that I downloaded a plugin that had the right name but suddenly a completely different plugin was on my server. e.g. TAB suddenly became ultimate shop
you sure you don't have a plugin doing something malicious here?
i need to edit this for armor pieces tho thanks a lot
oh sorry I forgot to attach log file
idk i test everything but i found nothing
as for download size, they are never going to be exact due to rounding and os etc
decompile the plugin and look for malicious code
if it's obfuscated just get rid of it
check your server startup log for any warnings or errors. Infections almost always show up as errors in the log
tab on spigotmc was 600kb and then from polymart 1300kb the polymart version works correct
if by infections you mean malicious plugins then they never show up
nothing
?paste your server latest.log from startup
if you don't have some kind of malicious plugin that infected your server jar then I can only assume you have a malicious ISP or you are using some proxy that does fishy things
wtf is a malicious ISP
does anyone know how to transfer data from the kyori CompoundBinaryTag to packet event's NBTCompound? I've tried this, but nothing gets copied java public static NBTCompound transformToNBTCompound(CompoundBinaryTag kyori) throws IOException { ByteArrayDataOutput baos = ByteStreams.newDataOutput(); BinaryTagIO.writer().write(kyori, baos); NBTCompound nbt = new NBTCompound(); DefaultNBTSerializer.INSTANCE.serializeTag(baos, nbt); return nbt; }
ISP = Internet Service Provider
arent isps big companies
ik but they can be malicious?
not always
they can be shitty and scam u but not malicious
i test it on 2 pc and exact the same download size
certainly, they control your connection to the outside world
test it on another internet
some abuse that
i will do
the main places where you will find malicious ISP's are in places where where you have no choice to use them because they are the only ones and provide basically poor service for expensive price.
because of this, they are free to essentially do what they want
anyways, can u stop camel dashing??
camel dashing?
im talking in general to anyone that knows how to stop camel dashing
camels are abit new so there arent any threads about that
change nothing but now tab is correct download on spigotmc
idk if it was a bug of the side
that prob means ur isp is malicious according to frostalf
i dont infectet
whats ur main problem?
i download litefish with 355kb but the file is 390kb big and i also download litefarm and this two plugins give me a problem what was not before.
and after i ask the author of the plugins he give me the correct one with 390kb downloaded from spigotmc, now this working
and i download tab in the morning this was some other plugin with the name of tab but it was ultimateshop that was loading on my server so
something is broken with spigotmc.org for me
Sounds like their is malware somewhere along the line
i mean
since u downloaded it with another internet and it worked
it's on ur isp's side not spigot
I did ask for a log but as you didn;t provide one https://www.spigotmc.org/resources/spigot-anti-malware.64982/
no i download tab on ploymart that was working
Hopefully this isn't novel otherwise anti malware won't catch this
what if the anti malware is malware
Can;t tell him any more without at least seeign a log
Ahhh yes I love when the spigot staff infect my pc with malware 100
there are often tell tale signs of a virus plugin
spigot (the biggest server software i think) doesnt just infect people
if they do that then they would get sued
Most of the time people get infected by malicious plugins that aren't yet scanned by optic
Or from piracy
^ they got it from some other site.
this is by spigot?
its by Optic_Fusion1
is this https://www.spigotmc.org/resources/mobs-to-eggs-catch-mobs-and-get-spawn-eggs.69425/
or this https://www.spigotmc.org/resources/simple-levels.110384/
malware?
so by spigot
Not really
By optic
Spigot isn't officially affiliated with his anti malware
thats a small plugin, ill decompile it
not open source as well, sussy
yeah no
dont use it, it's obfuscated
obfuscation isn't a clear sign but its too sus to use
(regaring the level one)
ok
MobsToEggs isn't even downloaded from spigot
@vagrant stratus someone might have malware if you care to investigate, they won't send logs tho...
MobsToEggs has some awfully obfuscated classes
MobsToEggs looks clean but it's poorly written
it even uses BoostedYaml, a derivative of SnakeYaml, for no reason
Spigot already has its own Yaml support
very much
and wtf is @Metadata
terrible plugin
what's the difference between these materials? BRICK vs BRICKS vs BRICK_WALL
BRICK is a brick, BRICKS are bricks, BRICK_WALL is a brick wall
thank me later
^^
Brick an item bricks a block brick wall is a brick wall
I don't think there is a brick wall, as in fence block
oh my shit there is
I'm overcomplicating things
Not much I can do w/o logs, especially if there's many plugins to go through. It's very time consuming
Yeah I asked him twice for logs, but no go.
considering it's made by a resource staff, it's not gonna be malicious lmao
And no, it's not officially endorsed by md
that was a joke lol
I sure believe you
can you sen me a pm pls i cant
?paste
banned for spam
real
you know your plugin is bad if it has a 3.4k line yml line
whoever wrote this needs a raise
subjective
Okay whoever told me several months ago that I wont be able to understand what I wrote back then
yeah they were pretty right lol
lol
my guy it has a permission for EACH MOB registered
do u even need permission registration
You can never have too many comments in code.
that was with the tab.jar what was loading as ultimateshop
ok
is payed
its rly crazzy on some other server tab was working as tab
and on 3 minigames server it was ultimateshop premium
description isnt descriptioning
thats the exact size what tab was
the logs look fine to me
thats why i say its some bug on spigotmc.org
Can you do a screenshot of your plugins folder?
for?
to compare
i feel like thats too much to ask ngl
most malwares dont create other files / plugins
what?
that just makes it more suspicious
okay and? Still happens
some of them download it in PluginMetrics cuz no one looks into that
Yea, I know
PermissionsEx š
^^
check pluginemetrics efor
Logs look clean. Plugins match logs
I've been dealing with this stuff since 2019 lol
all bar TAB
how?
do u have a pluginmetrics folder in plugins
no
i think it hide then i try to find
what is going on here
Something that should probably take place in #help-server
yeah lol
I'm intrigued but I don't get what this is even about lol
[06:40:48] [Server thread/INFO]: [UltimateShop] Enabling UltimateShop v2.2.3 is definately not running from TAB v4.1.4
that was the tab.jar
download tab from spigot not somewhere else
i remove it and use the one from polymart and it was tab after that
clear your browser cache first
then download from spigot
Untimate shop jar is only 637k
teh TAB jar is twice that size
has anyone actually taken a look into the jar itself and that it's not doing some weird stuff?=
we can;'t
yes and my was 637kb
its a paid plugin
tab is a paid plugin?
you should check the checksums
no it change on its own but i clear now
When exactly does the PluginEnableEvent get called? After the onEnable-method is done or before?
Is gradle vs maven something one should be aware of? Im at a stage where rewriting my plugin project wont be a problem but I dont know what are pros and cons of each
after
the onEnable has to finish without error before an event is thrown
gradle is annoying, maven is very easy to use. Plus MC dev already sets up everything
Having some issues adding items to an anvil inventory, the itemstack is not showing, but clicking the slot the itemstack is supposed to be in still activates what it's supposed to do
tbh from what i've heard here it's not much of a difference.
I prefer maven bc it's easier
maven has a bigger community and eco system.
gradle gives you more control over the compiling stages because writing custom code for it is easier.
very much perfect. thanks :D
I smell switch(slot)?
not at all using the gui tutorial as a base
?gui
i fucking love this btw. such a beautiful approach
K ika read that then lmao
public stringGui() {
super("", InventoryType.ANVIL);
}
@Override
public void decorate(Player p){
addButton(0,new InventoryButton()
.creator(player -> new ItemStack(Material.PAPER))
.consumer(inventoryClickEvent -> inventoryClickEvent.getWhoClicked().sendMessage("works"))
);
}
the default of an itemstack is always 1 iirc
yes
hmmm
from that code it should work i guess
I suppose the super call is to create the inventory or something?
what was the problem?
forgot the call decorate() š
absolutely sorry to waste your time
Dude no worries
I'm at work chilling my balls rn
Just started soo
?gui
check this out, it's from this
Lol
XD
really great resource
K
9.5/10
I will
It's a fairly advanced tutorial so if you just started with java you might not quite get it
I can also recommend the working with data tutorial
But i'm biting around at that as well still lol
Wtf was that image XD
that was 7's profile picture lol
XD
look in the users bar on the right under Discord Helper, 7smile7
(i don't wanna annoy him so i wont ping him)
@lost matrix how's your day going?
no idea where to find those files, dont find them in buildtools outputs either
trying to add nms
?nms
there is no maven metadata added by buildtools
damn lmao
don't give them ideas
Pretty fine, procrastinating a bit
procrastinating? why? ._.
follow teh wiki to the letter
is your bratwurst stinking less today?
just found it, but maven search a fle that has a different name
If you do exactly as the post tells you it will work
black red gold alert
do you have vps or dedicated i could upload a server for 2 days? Just dropped my server and now i need to showcase something...
Or a free host where i can upload stuff.
oh no... kraut
I actually do, but it';s kinda weak
laughs in homelab
Depends on how large the thing is and how convoluted it is to install lol
Its... just a mc server ^^
just
Ah its ok. I can probably find something free.
7, since you're here...
I'm still trying to work with your working with data tutorial (with an SQLite db).
I'm wondering.. If someone wishes to manually delete something with a command, should i delete it from the database directly AND from the ServerData (or whatever)? Bc idk if I can like compare the ServerData object and the DB-entries when something is missing
Sure, you should do a write-behind action for that. So delete from cache sync and from DB async.
ohhhhh
Ok ok, if it doesn't work you can hmu
I'm creating my custom entity which extends EntityZombie. The class is called SupremeZombieEntity. When I print out #getEntity under EntityDamageByEntityEvent it returns CraftZombie and not SupremeZombieEntity, thus I cannot check if the entity is instance of my custom entity. But when I spawn the entity in and then print it out, it prints out SupremeZombieEntity. I'd like to stick to basic java if possible and not associate my custom entity with any metadata. Any1 has any advice?
also, @lost matrix , i remember now i wrote this
Is there any API that would trigger the bubbling animation to play in the BrewerInventory window for players client side?
I'm assuming worst case scenario would be having to send network packets
Why can't I cast it to anvilinventory?
private final Inventory inventory;
...
this.inventory = Bukkit.createInventory(null, InventoryType.ANVIL, "");
...
AnvilInventory inv = (AnvilInventory) inventoryClickEvent.getClickedInventory();
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryCustom cannot be cast to class org.bukkit.inventory.AnvilInventory (org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryCustom and org.bukkit.inventory.AnvilInventory are in unnamed module of loader java.net.URLClassLoader @46ee7fe8)
Do someone know how to solve that Intelijj is asking me for a GPG key when trying to commit to github?? I've tried actually setting the GPG key but for some reason it says "Cannot find suitable private key" even when they are detecting the key
there's a private and a public key. The private key is used to sign the changes. Anyone with the public key can then verify that you actually made the change
if you haven't set a private key, you need to do that
gpg --full-generate-key i believe
because that's not how internals work
you'll need NMS for this
virtual inventories such as anvils, looms etc aren't easy to pull off. it takes a lot more than you might think and current internals are not setup to allow this
Okay, so I'm doing gpg --list-secret-keys --keyid-format=long
And the key is the same one as in intelijj
How to show message on top of the player when player send messages?
Display Entities would probably be the best way
That's annoying, thanks
and you didn't accidentally set the public key as the private key?
annoying, but how the current system works. You need to patch every single container like this to get it to work. You also need to modify some NMS Containers to allow multiple players to modify them.
Version 1.16.5
uuuh, how can i know if i did? xd
Armor Stands
wdym
set your currently set private key as the public key and the other way around
like, the public key is the one that is really long right?
I don't have that one on intelijj
I have the small one
I don't think I sent the correct registry data
no idea then. maybe intellij only likes a certain encryption scheme?
there's probably a wiki
I literally cannot do anything besides closing minecraft right now
can i make an invis person visible to himself
Like there are two posts that has the same problem "Cannot find a suitable private key" but there is not solve in those posts
and i cannot commit to github or export without that
how can i do an 2nd line at players nametag
man why don't you just use git from the command line haha
I mean, i could export before, but it started asking for this...
What do you mean with git from the command line?
create ur own nametag system
make a text display ride on the player
text displays are amazing since they have transformation which is basically teleporting the text without changing the actual entity location
is there a way to force a queued task to be executed immediately?
e.g. runTaskLater
cancel it and run task
huh? on BukkitTask?
BukkitTask#cancel
?
no the rerunning part
you cannot start a new bukkittask with a bukkittask parameter
Use a BukkitRunnable, then you can cancel and directly call run
I am getting this error
Caused by: java.lang.IllegalStateException: InventoryOpenEvent cannot be triggered asynchronously from another thread.
public void onChat(AsyncPlayerChatEvent event){
This works while using the depricated PlayerChatEvent, but because it's depricated I don't want to use it.
is there any way how I can circumvent this?
I literally don't get it
oh ok I get it. Yeah that'll work, thanks!
thanks for the quick response š
Same answer for both š
a man of multitasking
how do i check if a bitmask is present in protocollib, i want to check if its setting the invisibility state
& it
watchableObject.getValue() & 0x20?
yes
if i want to make it so Is invisible is false, what do i do?
then use a full bitmask, excluding 0x20
?
Something like mask &= 0x20
I think you can just bitwise not the whole thing, or it with the isInvisible bit and not it again
well taht will disable it if it's on, no idea what happens when it's off
It'll mess the whole thing
if you want teh full byte with is invisible always false
bitwise stuff is black magic
value = byte & 0b11111011
tf is 0B11111011
binary
bruh
ik its binary
the 0B had me confused lol
I didn't even know anything other than 0x existed. I guess X for heX
aight thanks
a name wider than my display is typing.
There's also inta, long that start with a 0
Those are octets
https://paste.md-5.net/otafefofox.bash <-- error
manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES, PacketType.Play.Server.ENTITY_EQUIPMENT, PacketType.Play.Server.ENTITY_METADATA) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
if (packet.getType() == PacketType.Play.Server.WORLD_PARTICLES) {
?
} else if (packet.getType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {
?
} else if (packet.getType() == PacketType.Play.Server.ENTITY_METADATA) {
List<WrappedWatchableObject> metadata = event.getPacket().getWatchableCollectionModifier().readSafely(0);
WrappedWatchableObject watchableObject = metadata.stream()
.filter(obj -> obj.getIndex() == 0)
.findFirst()
.orElse(null);
if (watchableObject != null) {
Object value = watchableObject.getValue();
if (value instanceof Byte) {
byte bitmask = (byte) value;
Bukkit.broadcastMessage(String.valueOf((bitmask & 0x20) != 0));
}
}
}```
how about you start with a switch statement xD
looks awful for big code like that
why is there no auto-breaking switch statement
switch statement should use continue to go to the next branch instead of always going there lol
fallthrough is already a thing in switch statements tho
lambda switch is auto
switch expressions don't allow you to do that, yeah
you have the yield keyword in switch expressions
taht's what I mean
switch(true)
case true: {
// executes
}
case false: {
// executes too :/
}
yeah..?
in 9/10 cases you break out of switch statements at every condition
it should break by default and allow you to go to the next statement using continue
switch statements are really just mostly fancy if-statements and the breaking problem really takes away from the possible experience
Hi there, is there any reason why I can get the ender dragon battle not much longer after the dragon it was killed but I get null after an hour? Isn't it supposed to always return a battle in the end world?
switch(true)
case true -> {};
case false -> {};
}```
it just doesn't?
ok neat I need this in like every other language now
any language designed post 2010 will have far better switch/when cases anyway :^)
does rust's match fall through
typescript doesn't
sad
lua and c++ are also both too old to have that lol
I know zero recent languages
according to the rust book, it doesn't (awesome sauce)
Think of a match expression as being like a coin-sorting machine: coins slide down a track with variously sized holes along it, and each coin falls through the first hole it encounters that it fits into. In the same way, values go through each pattern in a match, and at the first pattern the value āfits,ā the value falls into the associated code block to be used during execution.
This sounds like Kotlin propaganda

I'm banning you from r/java
can you ban me from reddit instead
and hackernews, that's just reddit for closeted redditors
That adds up
DId sOmEone say KotLin
š½
Hello! I try to set the custom value of ender dragon bossbar using protocol lib, but I get error at the field "Action". I have tried to put bytes, but didn't work. Then I tried to use explosion packet, but I get the same error at the field with VarInt Enum type. Can someone help, how can I use it?
how do i get the previous inventory in a InventoryOpenEvent?
what prev inv
if u open an inventory to a player while he has an open inventory
it updates the inventory
If one is open you will get a close event for it before the new inventory opens
why do you want the old inventory?
so basically when it "updates" the currently opened inventory it doesnt move the cursor to the middle, the cursor remains where it is
wait...
why do i need the previous inventory..
do not use wiki.vg if you're going to use protocollib, wiki.vg shows you the byte stream format that goes on the network, protocollib works by reading/modifying the java packet fields instead
see that there is no int for the action, but an Operation value https://mappings.cephx.dev/1.20.4/net/minecraft/network/protocol/game/ClientboundBossEventPacket.html
when i for example create a variable:
String stuff = getConfig().getString("blabla")
will the code get string from the config every time i use that variable or will it do only once and save it?
i mean after i reload the config do i have to set stuff variable again to the same key thing?
yes
yes you have to or?
yes you have
you have to
wdym
Well, I just started to use packets (and still learning them), could you please tell me, what function should I use? In protocol lib there no such function with the name similar to "getBossBarOperation" or something.
As for NMS packet class, when I want to write my own value, it required FriendlyByteBuf, about which I can't find any tutorials and it possibly means that there's another way to set my custom amount
What defines āside effectsā?
a haskell dev nightmare
how would I detect when a player loses a potion effect via. /effect clear?
playerpreprocesscommandevent, then validate player's perms to see if they can run the command and get their current effects to see which effects they'll lose
Custom event
There's actually an event for that kek
there is a what now?
how would I get the command sent with the event?
i have
Why would I do that when I create my own event to detect command usages? D:
read them better
split on space
i just wanted to make sure i have understood it correctly...
thanks
check if args is 2 or 3 if 2 its on themself if its 3 its on someone else and boom
you can call an event after you validate that the player can run it
but why
I just trollin man
does #getMessage() include the slash at the beginning
nah theres no way it does
1 sec
im gonna say no
but dont quote me
I can't imagine this to be one of the cases where it returns a /
lol in my listener i do this
final String commandMessage = message.startsWith("/") ? message.substring(1) : message;
where kotlin
even bigger where kotlin
because he wanted the source code
transpile smh
and he only knew java
smh
Bruh
yeah i'd much rather do it in kotlin
if you know java you can very easily read kotlin D:
but it went fine
kotlin is bad
no
Kotlin's use of var makes me wish java was as cool D:
everyone is entitled to their own opinion on kotlin you might not like it but others do
nah
look at this stupid function signature that i wrote yesterday or smth lol
private suspend inline fun <reified T> downloadAndParse(crossinline downloadCallback: suspend BackendAPI.() -> Response<ResponseBody>): T? = coroutineScope {
ooo coroutines
also the out and in for arrays will be confusing when used to java
true
ye
looks like some node.js stuff
full function because why not
private suspend inline fun <reified T> downloadAndParse(crossinline downloadCallback: suspend BackendAPI.() -> Response<ResponseBody>): T? = coroutineScope {
val file = api.downloadCallback()
if (!file.isSuccessful) return@coroutineScope null
val body = file.body() ?: return@coroutineScope null
var input: InputStream? = null
try {
input = body.byteStream()
return@coroutineScope input.reader().use { plugin.gson.fromJson(it, T::class.java) }
} finally {
input?.close()
}
}
suspend fun!
i didnt know i cou ld do = coroutineScope {}
that's me rn i'm procrastinating on some very fun math hw
im stealing that tyvm
What's the difference between fibers and coroutines?
fibers?
fiber optic cable core
Sure
do you mean futures
lmafo
Sorry my autocorrect
well truth be told i do not know, coroutines are just more convenient for me to use in kotlin because of fun syntax and cool stuff and stuff and stuff
maybe someone s willing to educate me on the matter
Ah gotcha
theyre basically the same thing just coroutines support kotlin better
yea, now java AT LEAST has virtual threads, and soon structured concurrency
sooo i mean
fibers as in async await?
whats crossinline again, inline accross translation units?
No I did mean futures, it just autocorrected
and then my ide screamed at me to make the argument callback thing crossinline
I didn't know fibers were a thing lol
so i guess it means that it gets inlined too
no
it means theres a specialization of that function for every param of T
Oh lol, yeah no that was not meant to be fibers at first but hey that's cool to know
yea, but w futures I assume u mean promises (more generally)
Well no I just meant in the fact that they both do basically the same thing and I wasn't sure if there was any big difference