#help-development
1 messages ยท Page 827 of 1
what is the problem
attribute doesn't exist on that entity
package com.amirparsa.iranskyentities.entities;
import com.amirparsa.hypixelcustomitems.Items.Fishing.SavvyInk;
import com.amirparsa.hypixelcustomitems.KeyStore;
import com.amirparsa.iranskyentities.CustomEntity;
import com.amirparsa.iranskyentities.TextData;
import com.amirparsa.iranskyentities.datastore.Equipment;
import com.amirparsa.iranskyentities.datastore.Rarity;
import com.amirparsa.iranskyentities.datastore.Stats;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
public class SavvySquid extends CustomEntity {
public SavvySquid(){
setStats(new Stats(
150f,
10,
5,
300
));
setEquipment(new Equipment(null,null,null,null,null));
setRarity(Rarity.COMMON);
getDrops().addDrop(new SavvyInk().build(KeyStore.getItemKey()), 1);
getDrops().setRepeats(1);
setId("SAVVY_SQUID");
setName(TextData.getString("data.entity.SAVVY_SQUID.name"));
setEntityType(EntityType.SQUID);
}
@Override
public void customSpawnFeatures(LivingEntity entity, Player spawner) {
}
@Override
public void onEntityDeath(EntityDeathEvent e) {
}
@Override
public void onEntityDamage(EntityDamageByEntityEvent e) {
}
}
?paste
nothing you posted uses attributes
no
I have a feeling damage is only on weapons
okay then imma wrap them in try{}catch(Exception ignore){}
yoooo it works
u tryna fetch attributes on entities that may not support them, right?
does someone know why that could happen on a spigot plugin with jetty embedded? sh java.lang.IncompatibleClassChangeError: Class org.eclipse.jetty.util.ArrayTernaryTrie$Growing does not implement the requested interface org.eclipse.jetty.util.Index$Mutable
looks liek trying to modify an immutable array
idk is just jetty, i didn't modify any array
Nah that's not an immutable error
That's a this class impliements an interface but fails to impliment one of its methods
looks like some sort of linkage error ye
Stop breaking the world smh
shake my smh coll
is the cost in terms of ram the same when creating an object as well a maintaining it?
i mean keeping it in memory is arguably more work as u occupy on heap memory and it needs to be checked if it can be gcd or not
so instant delete once not in use?
even though i could get used the next secodn and then needs to be recreated?
well what exactly ru trying to do
i attach a java object to an itemstack so that it is marked as custom
u have phantom and soft references as well
e.g. if you're actively using a list it won't just randomly get GC'd
once the item is dropped i delete object
and then other stuff like Reference::reachabilityFence
sounds like an overcomplicated solution to just using pdc to mark an item
I think you are talking at crossed purposes
im using pdc
java exists so you don't have to worry about low level memory collection etc take advantage of that and just don't care unless you hyper optimziing something
youraslvation is performance an actual problem in ur case?
or ru just prematurely acting rn?
i just wanted to optimize
idk if theirs anything you can do yourself to optimize pdc ๐ค
yes well the general idea behind java object allocation is to keep ur objects around as long as you need them
and then java will dispose of them when needed
keep ur objects around as long as you need them just be careful this this because if you do something stupid and never clear a cache etc that's how you end up with memory leaks
then you've kept them around longer for what you need them but yes
more so want to stress the importance of the cognizance of the expected life time of your object and ensuring you've removed your references to it. Really though even then you shouldn't really have to worry about this as far as PDC goes
since all your data is stored in PDC, the API abstracts the worry away for you
thing is, java is really good at figuring what references arent strongly held anymore, the reason it can be a bit lacking in terms of collections is that most (almost all of them) assume you want a strong reference to the elements in them when you insert
managing your references and variables and mem in general is way more important in lower level langs for good reasons
I want to learn more about JVM and JIT now that I've got an okay understanding of low level thinking though I did wanna spend a bit more time on x86 I finally learned MIPS so it should be pretty easy to just transfer my knowledge over to x86 seeing as all that differs is the calls and a bit dif on registers. Nothing a little pdf can't fix though
yea lol
i touched mips, alr got my braincells turned around
but u should learn cpp right?
since a lot of java is in cpp
ahh I was learning C,but I stopped for a bit cuz I really didn't feel like learning macros
it seemed like a pain in the Ass to execute generic like syntax for data structures
plus I had finals coming up and I really didn't have time to pull my hair out over C and finals
what should i do?
ah, well I think cpp is enough, like ofc c is rly good to learn for ur own understanding
More so what I'm going for here. I mean considering my career of choice is specifically embedded systems I'd love to learn C the only pain is cmake is literally shit I feel completely spoiled with maven/gradle and whatever go's thing is called
What 50 years and still no proper thing better than cmake??
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/evilblock/pidgin/message/listener/MessageListener```
whats up with this? I think I added the right dir in my pom and yet
does it work with a fresh server start?
run a mvn clean package
I dont think I got maven installed
how are you building?
mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ mvn clean
+ ~~~
+ CategoryInfo : ObjectNotFound: (mvn:String) [], CommandNotFoundException
this happens
I want to run bungeecord player's command in Java(Kotlin) Plugin.
event.player.performCommand("party chat")
My Code ^^^^
In ItemHeldEvent, party chat is bungeecord plugin's command. but it's cannot run. how can I fix it?
P.S. I already use Bukkit.dispatchCommand and Bukkit.getServer().dispatchCommand :<
will not work
i can't?
performCommand is local to the server and never seen by bungee
how can using bungeecord command?
?pmc
thk
help
wrong version of jetty for the java version you run
jetty 11 isn't for java 11?
I did the mvn clean thing
and yet
[16:21:23 ERROR]: Could not load 'plugins/Core-v023-Build-A.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: pvp/core/club/shaded/pidgin/message/listener/MessageListener```
could I try exluding pigdin from shading?
is your plugin building for java 11?
is your server running java 11?
elgarll
was it for me
yes both
or the other guy?
it just suggests its own product
if you are depending on pidgen you have to shade it
if its a shadable resource
<dependency>
<groupId>net.evilblock.pidgin</groupId>
<artifactId>pidgin</artifactId>
<version>1.0</version>
System path thing here
<exclusions>
<exclusion>
<groupId>monke</groupId>
<artifactId>monke</artifactId>
</exclusion>
</exclusions>
</dependency>
and then the other one
am I right?
worth a shot
your error says it's looking for a shade path, if you are not shading/relocation that is why it can't find it
wym?
your error says pvp/core/club/shaded/pidgin/message/listener/MessageListener
I think I got it
so you must/should shade/relocate pidgin to that location in your jar
when selecting in fawe this white box apears without mods. Does someone know how to do it? It is also client side
and u're not in f3 mode?
no
7smile7 was playign around doing that a while back
why f3? it shows coordinates and stuff
did u meant the one that shows entity boxes
i think he did w normal particles
im actually done with redis
@lost matrix ^ you did this a while back didn't you?
bye bye redis you have served me well
bye all of you
lol
nah he was rendering to sides
it doesnt look like particles
the line gets smaller when u get closer
particles dont
im gonna try to look at the source code
Yeah ive tried a few things, including scaled slimes.
This one looks like the structure block outline to me.
Whats wrong with redis?
I personally like mongodb
they are sorta meant for different things

Mongodb the #1 redis replacement ๐ช๐ฅ
Pretty much what conclure said. Completely different applications.
Its like saying "Bye Spigot. Im using Bungeecord now."
I just noticed
it spawns a structure black
block
i mean whether u use monogodb directly or something like redis depends on your use cases I guess
i mean whether u use monogodb directly or something like redis depends on your use cases
I guess
fify
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.Tag.getValues()" because "org.bukkit.Tag.ITEMS_FURNACE_MATERIALS" is null
code
public void onInventoryInteract(InventoryClickEvent event){
System.out.println(event.getRawSlot());
for(Material a : Tag.ITEMS_FURNACE_MATERIALS.getValues()){
System.out.println(a);
}
}
What's wrong??
I need set of fuels
everything that can be fuel for furnace
Should looping through an array in my ram be done async or will it not help?
Depends, kind of.
Since you're new to Java avoid async
You'll most likely make things slower and break stuff
damn I use async almost all of the time in my plugins ๐
Oh yeah, async can be dangerous
Even if my ArrayList is 200 objects long I shouldnt use Async?
Now ask yourself why do you need to go through 200 objects
๐
that matches player uuid - arraylist sethome object uuid
200 objects is basically nothing lol
for (HomeLocation home : homeLocations) {
if(home.getUUID().equals(sender.getUniqueId())) {
return home;
}
}
return null;
}```
computers are fast. if you have 20k objects I would worry about that, but not with 200
That's quite a poor way of storing the homes
damn fr?
and yes, that could use a map or something
^ and don't store all the homes in a single json file
rip why not
you'll need to load the entire thing in to memory to read from it
Now what happens if you have a lot of users
I think HashMap would be more easy... Like homes.get(player.getUniqueId())
I guess on server start I could try loading the homes into a hashmap
Keeping homes of players that aren't online in memory is just a waste
yeah but you still wouldn't want to load all homes. No reason to load homes from that random user who last logged in two years ago
{
"uuid": "3b4b5172-4860-4191-bda8-1be9ae7cace8",
"worldName": "heese",
"x": 1261,
"y": 56,
"z": 2720,
"yaw": 56.58,
"pitch": 86.69
},
{
"uuid": "830eb1b9-441d-4f15-a011-7b8688841003",
"worldName": "heese",
"x": 10315,
"y": 62,
"z": 9777,
"yaw": 250.95,
"pitch": 46.65
},
{
"uuid": "6132603f-8b63-4e8d-93a2-b780e854affa",
"worldName": "heese",
"x": 1511,
"y": 68,
"z": 606,
"yaw": 45.74,
"pitch": 11.19
},
{
"uuid": "a639919a-1213-4e82-a56b-31f09dace6b3",
"worldName": "heese",
"x": -6432,
"y": 97,
"z": -2325,
"yaw": 117.11,
"pitch": 24.9
},
{
"uuid": "e87b776c-74f1-4f31-a936-fa1cddb2b634",
"worldName": "heese",
"x": 10350,
"y": 72,
"z": -8715,
"yaw": 116.28,
"pitch": 18.6
},
{
"uuid": "f08e4f92-a3ed-43a7-adee-d22c68a13d80",
"worldName": "heese",
"x": -15150,
"y": -51,
"z": 15277,
"yaw": 132.17,
"pitch": -2.08
}
]```
an example
true
Ig you could load the homes of the players that log in and then load them out when they log out, by that logic
you could store them per user, and give the file the user uuid as name. and then just load that when they log in
And you should also probably store them in a subdirectory in your plugin data folder, I think
I would store every user in HashMap on server load and use HashMap.get(player.getUniqueId)
ok so
playeruuid.json containing
[
{
"uuid": "f08e4f92-a3ed-43a7-adee-d22c68a13d80",
"worldName": "heese",
"x": -15150,
"y": -51,
"z": 15277,
"yaw": 132.17,
"pitch": -2.08
}
]```
load it when they join, save when they leave?
yeah for example
Well that's a bad idea
why not?
I think its better to do the hashmap when they join
If users have multiple homes that won't work
Why load data for users that aren't online
And delete when they leave
You're just wasting memory at that point
So you'd also end up having a HashMap<Player, List<HomeObject>>
But if you want to add or remove player's data on join/leave you need every time go threw json file with 200 players
Yeah which is why I said that's a bad way of storing the data
btw yml config is better
doesn't really make much of a difference here
Isn't it slower
eh negligable
it makes cause you can just do getFileConfigurationSection.get(player.getUniqueId())
get(key) also exists in json
Simpler, but I find json kinda better for things like that, idk why
oh
ok i think what imma do is when a player joins I'll loop through homes.json, grab their home, put it in a hashmap and when they leave I save it back
ok
@chrome beacon why
If you had one file per user you wouldn't need to loop at all
^^
whats wrong with my plan
Just do what Malfrador told you to do
But I'd need to migrate my entire homes.json somehow again ๐
do the loopy thing when they log in, but always save to the user file
then everytime someone logs in for the first time after the change, their homes will be migrated
What about the thing that hashmaps have one value per key
Do you really need an array of home objects?
Just thinking, is there some better way than that?
if users can have multiple homes, yeah. but just putting a list into the hashmap should be fine for that
or a set or whatever collection you want
Ugly ass HashMap definition lol
oh btw I forgot to mention but theyre in a Set not an ArrayList
does that make a difference
public static final Set<HomeLocation> homeLocations = new HashSet<>();
no. the set has no order, while the arraylist will have an order. but that shouldn't matter for homes
why is that public static
That is a good question
no clue my friend made it
Dependency injection moment ig?
yeah it probably shouldn't be public static lol
private then?
and you'd probably want to do some stuff with mutability and however tf it's done, idk
private static?
depends on where it is. I would make one UserData class, instance that per (online) player and then have the homes as private in that class
At that point it's just kinda like files in ram stuff lol
well yeah probably overkill if all that plugin does is homes. but if you have more than one thing to store per user, or expect that to be the case in the future
homes 2,3 and 4 ?
XDD
you can get for voting
I mean...
yaml is a json superset
Hi I am searching a packet for change the pitch and the yaw of a player, I am using NMS with spigot 1.20.2
json is faster parsing wise I believe since its more strict in terms of syntax
pretty sure there is API for that? no packet needed
Player#lookAt
unless thats Paper only
That doesn't exist on spigot ?
idk, it might. I haven't checked just use paper
@lost matrix I found solution for the problem btw
Libby dependency was bringing Bungee and Velocity jar content with it from some reason
Could anyone help? What's wrong with it? I just want tag of fuels, and IntelijIdea says that there is a Tag.ITEMS_FURNACE_MATERIALS
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.Tag.getValues()" because "org.bukkit.Tag.ITEMS_FURNACE_MATERIALS" is null
code
public void onInventoryInteract(InventoryClickEvent event){
System.out.println(event.getRawSlot());
for(Material a : Tag.ITEMS_FURNACE_MATERIALS.getValues()){
System.out.println(a);
}
}
Furnace materials tag hasn't existed since 1.16.2
one of the many reasons why having static constants in the API for that stuff is a bad idea. there are multiple tags for burnable stuff, look at https://minecraft.wiki/w/Tag#Items
garbage
I found this but doesn't work have you an idea I have never used packets ?
public static void setPlayerOrientation(Player player, float pitch, float yaw) {
CraftPlayer craftPlayer = (CraftPlayer) player;
byte bytePitch = (byte) (pitch * 256 / 360);
byte byteYaw = (byte) (yaw * 256 / 360);
craftPlayer.getHandle().c.a(new PacketPlayOutEntity.PacketPlayOutEntityLook(craftPlayer.getEntityId(), bytePitch, byteYaw, false));
}
is it possbiel to ingnore this
have a look at wiki.vg, and if you never used packets you might want to use a packet library. and that looks like obfuscated NMS, thats just annoying to use. But I already suggested a much easier solution, just use server software that provides API for that stuff.
no lol, that's a hard compilation error
https://paste.md-5.net/qoweyoloru.apache
could someone tell me which plugin this stacktrace is coming from?
?whereami
all me
why does it hard compile error
you're missing a dependency on the compilation classpath
does that mean i have to do something in pom.xml
no idea
Ok thank you
well i mean i assume that com.tjplaysnow is a package from a library so you would have to add that as a dependency in your pom
when you use build tools
or here wait
Why does bukkit or minecraft make their code so weird
they're using like a reverse guard clause or something
reverse guard clause?
because mojang is nice enough to provide mappings for modders, but the game isn't open source for legal reasons
Likely a case of either (a) old code. it isn't broken, don't need to fix it, (b) CraftBukkit patches to avoid minimal diff, or (c) symptom of a decompiler
Yeah might be the decompiler
d) client code being stripped out
I used some random online decompiler cause I'm on my phone ๐
That as well
Though I think they do that less and less now-a-days
the principle of "not overengineering everything"? lol
because mojang loves to do that
SOLID principals
some of the codebase is still very much "notch wrote this in a few days in 2009", and some of the newer stuff is needlessly overengineered. but overall imo the minecraft codebase isn't too bad anymore. just blindly applying some theoretical principles to a project makes no sense anyways
Especially when some of those principles really aren't suited towards modern software. They don't really take into account the power of modern compilers, and modern software features, etc.
1.13 did a lot of changes, before that it really was a mess. and 1.8 was ten years ago, safe to assume mojang has learned a lot in that time too
idk what that means, but even if I did, my ability to discuss things about Hypixel are fairly limited
Damage that ignores any damage modifiers
so for example:
player with full diamond armor, resistance 2
True damage: 2
Player still losing 1 full heart
isn't that just a value in the damage event :p
I was just wondering if they use nms for that, or use .setHealth
I don't think choco is going to help you make a 1 to 1 hypixel clone regardless of his status at hypixel
as I said before it is up to you to figure it out my mans
it's not I just wanna make my own gamemode
setHealth is the easy way
idk every time I've used that, it's just handling hell
Hypixel rewrote that entire part anyways
which if you want to do any larger changes to combat (or just good cross version compat) is kinda needed
I'm going through nms rn and I'm seeing a damage source has the option for .setIgnoreArmor()
But can a damagesource ignore potion effects too or nah
hey a little question do u guys see any problem in this line? it just doesnt generate a tree, everything else is good i even put debugs to check the localisation and its a valid localisation
does the world exist
yep
and im in it and the location is exactly where it needs to be
but it doesnt work
Sure the location doesn't need to be one block higher
i am going to check this out !
Does anyone know of a website/api that simply has the 16x16 default item textures for different materials?
?xy
Asking about your attempted solution rather than your actual problem
Thank you so much, you were in fact right
No worries
I just need the images for use in Bedrock forms
Can the forms not reference resources?
In any case I doubt someone will appreciate you using their website for your form, host it yourself
Well I was looking for an api to be honest, worst case I'll just use a github repo
Not that I am aware of
https://mcasset.cloud/1.20.4/assets/minecraft/textures/item
idk if it has an API though, and iirc it has some pretty strict ratelimits
that'll do, thank youu
I'm trying to get a TextDisplay to mount onto a ServerPlayer, it works but only when the chunk is reloaded does the TextDisplay actually appear above the player.
boolean b = ((CraftTextDisplay) textDisplay).getHandle().startRiding(serverPlayer, true); // b=true
Anyone got any ideas?
Why are you using nms for that
The server player is an NPC
And I donโt think getBukkitEntity works on server players
(If theyโre an npc)
sounds like some sort of desync. mount packet not being correctly sent or something
How to get how long item is burning in furnace?
I found Material.isFuel but didn't find the time
I guess abstract class has no "onSlashCommandInteraction"
declaration: package: org.bukkit.block, interface: Furnace
It's not what I mean, i have an item and i want to know how long would it burn in furnace, i don't have a furnace
heya! which event is called when a player uses a fishing rod? (not when the player captures something and reels it back)
Function<Double, Double> resistance = new Function<Double, Double>() {
public Double apply(Double f) {
if (!damagesource.isStarvation() && EntityLiving.this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
int i = (EntityLiving.this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f.floatValue() * j;
return Double.valueOf(-(f.doubleValue() - (f1 / 25.0F)));
}
return Double.valueOf(-0.0D);
}
};
float resistanceModifier = ((Double)resistance.apply(Double.valueOf(f))).floatValue();
f += resistanceModifier;
Anyone know how I can change the resistance modifier to not apply
and I need the dmg source to be an entity type
wat
This is in a method
Like a section
DoubleUnaryOperator > Function<Double,Double>
is it possible to create block without adding it to the world?
well this is nms
idk how im supposed to edit
Oh, thatโs nms code?
yeah
Goofy shit
it's rly annoying how it's all just stacked in one method
if (!damagesource.isStarvation() && EntityLiving.this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { this is the only thing
maybe i can spoof it to be a starvation dmg?
Easiest is probably doing the calculation yourself and setting the health
Hello, once again, does anyone know how to make a ONE biome World
public class SingleBiomeProvider extends BiomeProvider {
private final Biome biome;
public SingleBiomeProvider(Biome biome) {
this.biome = biome;
}
@Override
public Biome getBiome(WorldInfo worldInfo, int x, int y, int z) {
return biome;
}
@Override
public List<Biome> getBiomes(WorldInfo worldInfo) {
return Collections.singletonList(biome);
}
}
Make a custom biome provider that only returns one biome
spoon moment
Oh hey I wonder where that came from
same
and where do i define my biome during the creation of the world?
thx !
just to understand the logic, this defines a biomeprovider so that when the world is generated and tried to get its biome it only gets the biome i defined?
Mhm
so, it works but i have huge patches of water, any way to get rid of them?
If anyone has experience with the dynmap api and can explain to me how accessing the api works, I would really appreciate it. https://github.com/webbukkit/dynmap/wiki/Dynmap-API I have asked in the dynmap discord, but all I get is crickets.
I am not sure where to put the DynmapCommonAPIListener.register method and how to get the DynmapCommonAPI object out.
Using .register requires a DynmapCommonAPiListener as a parameter.
yes, you create your own subclass of it
So this is similar to Bukkit.getPluginManager.registerEvents()?
uh, sure, except that you don't use @EventHandlers but override the methods that you need to implement
Okay, I think I am on the verge of getting it.
๐
I made a class called Dynmap that extends DynmapCommonAPIListener. When apiEnabled triggers, it assigns the api to dynmapCommonAPI, which I then use with an eventhandler to make a marker.
I have DynmapCommonAPIListener.register(new Dynmap()); in my OnEnable.
However, I just tested it and got an error that dynmapCommonAPI is null ๐ค
I am trying to use player.lookAt with paper for player to look at a specific direction (yaw, pitch) but I have an error in my consol when I start my server :
Location location = p.getLocation();
location.setPitch(pitch);
location.setYaw(yaw);
p.lookAt(location, LookAnchor.EYES);
Caused by: java.lang.ClassNotFoundException: io.papermc.paper.math.Position
how can i use ProtocolLib to do this?
hi , anyone Used ormlite? if so , how would i have a list of strings for example :
User favorite Maps
it will be list , how would i make that happen?
This is what i have so far :
a FavoriteUser :
will have a list of favorite maps
so lets say :
- Map2
- Map15
- DragonKillerMap
- ... just an example
etc
and Map is also dao ?
kinda weird for arena to have just name
but you would have to look into relationships
,-, it have other data but i only need the name
this is how its done in hibernate, you would need 1 to many relationship
it would be something similar
alright thanks
at ca.nagasonic.skonic.elements.skins.EffFakeSkin.execute(EffFakeSkin.java:53) ~[Skonic-1.0.5.jar:?]
at ch.njol.skript.lang.Effect.run(Effect.java:50) ~[Skript (5).jar:?]
at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:62) ~[Skript (5).jar:?]
at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:90) ~[Skript (5).jar:?]
at ch.njol.skript.command.Commands.handleEffectCommand(Commands.java:200) ~[Skript (5).jar:?]
at ch.njol.skript.command.Commands$2.lambda$onPlayerChat$0(Commands.java:299) ~[Skript (5).jar:?]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftFuture.run(CraftFuture.java:88) ~[paper-1.19.4.jar:git-Paper-550]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.4.jar:git-Paper-550]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1483) ~[paper-1.19.4.jar:git-Paper-550]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.4.jar:git-Paper-550]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.4.jar:git-Paper-550]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.19.4.jar:git-Paper-550]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-550]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]```
Can recommend. But 6.1's indices on table creation are bugged
Class<?> craftPlayer = getCraftClass("entity.CraftPlayer");
Class<?> playerConnection = getNMSClass("server.network", "PlayerConnection");
Class<?> playerCommonConnection;
Class<?> serverLevel = getNMSClass("server.level", "ServerLevel");
if (supports(20) && supportsPatch(2)) {
// The packet send method has been abstracted from ServerGamePacketListenerImpl to ServerCommonPacketListenerImpl in 1.20.2
playerCommonConnection = getNMSClass("server.network", "ServerCommonPacketListenerImpl");
} else {
playerCommonConnection = playerConnection;
}
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle sendPacket = null, getHandle = null, connection = null, getServerLevel = null;
try {
connection = lookup.findGetter(entityPlayer,
v(20, "c").v(17, "b").orElse("playerConnection"), playerConnection);
getHandle = lookup.findVirtual(craftPlayer, "getHandle", MethodType.methodType(entityPlayer));
sendPacket = lookup.findVirtual(playerCommonConnection,
v(20, 2, "b").v(18, "a").orElse("sendPacket"),
MethodType.methodType(void.class, getNMSClass("network.protocol", "Packet")));
getServerLevel = lookup.findVirtual(entityPlayer,
v(20, "f").v(17, "c").orElse("serverLevel"), MethodType.methodType(entityPlayer));
} catch (NoSuchMethodException | NoSuchFieldException | IllegalAccessException ex) {
ex.printStackTrace();
}
PLAYER_CONNECTION = connection;
SEND_PACKET = sendPacket;
GET_HANDLE = getHandle;
GET_SERVER_LEVEL = getServerLevel;```
does spigot have tickrate methods yet
what are you refering to exactly ?
/tick command
isn't it like vanilla in the newest version ?
i dont think that api has been merged
๐ก
Just wait for me buddy I'm on it ๐ข I just can't get this damn formatting right
thanks!!!!!!
More people should be excited about Inventory PR back in my day it was all the rage
how can i fix this error?
whts that
Well it's the greatest thing on earth my friend. It fixed up a bunch of issues with bukkits current inventory system
For example can't create working stations from Bukkit.createInventory and adds some other missing API
oh
i just
dont know if this is good or bad
public interface CustomItemListener extends Listener {
default void onDamagedWhileWearing(EntityDamageEvent event) {}
default void onDamagedWhileHolding(EntityDamageEvent event) {}
default void onDamagedByPlayerWhileWearing(EntityDamageByEntityEvent event, DamageEventInfo info) {}
default void onDamagedByPlayerWhileHolding(EntityDamageByEntityEvent event, DamageEventInfo info) {}
default void onAttackPlayerWhileWearing(EntityDamageByEntityEvent event, DamageEventInfo info) {}
default void onAttackPlayerWhileHolding(EntityDamageByEntityEvent event, DamageEventInfo info) {}
}```
Error
I mean it's never not been done before. Pretty sure JDA does exactly this with their AbstractListener or something like that
Kids these days is this what they do instead of rejoice about inventory pr
yeah they do
that inspired me
i kinda like it
I mean I kinda don't but it's up to you how you design your libraries I suppose
Alright all this talk of inventory pr has truly made me hungry I'm saddened to say I must go
how would u have done it?
It makes me contemplate existence. It's funky way to do it
hey how do you depend on a local jar in maven in pom.xml?
do i add a new <dependency> but what do I put in
the same info in the other pom
This is what I've found, I guess it's correct? https://gist.github.com/timmolderez/92bea7cc90201cd3273a07cf21d119eb
is this supposed to get the generic type of a class?
(Class<V>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
because it throws a classcastexception. This is the class name:
public class StatisticKey<V extends CitadelStatistic<V>>
i'm pretty sure i got it working for another class
tho the name was slightly different
public class MyClass<T>
instead of T extends...
not sure if that makes a difference
i can just pass the type class into the constructor argument, but me being the average developer i'd rather spend 1 hour on this than 1 minute to add the type class to the constructor args
How can you forget me I am the current maintainer of inventory pr
You wouldn't get it you paper folk don't have inventory PR its a spigot exclusive
what's the inventory pr about?
I'm on my phone but I'd love to have a 10 hour seminar about it
.
Wdym by this
yeah i agree
also anyone can just implement that with a plugin
so no need to pr that into spigot
It's really the virtual inventory stuff that need to be reimpelemented
As it had some problematic behavior
getGenericSuperclass does just what it says. Your class only has Object as a superclass.
getClass actually returns the subclass class, so getGenericSuperclass will return the class itself
getClass on what? you aren't showing what you are calling getClass on
class Whatever<T> {
}
((ParameterizedType) (new Whatever<SomeType<SomeOtherType>>( {}.getClass().getGenericSuperclass())).getActualTypeArguments();
this works
will return a ParameterizedType cause SomeType is parameterized
you cannot cast it to Class
basically i thought that my class was a superclass of another one, so the subclass invoking the super constructor would make getClass return the subclass class object
i've just passed the class object in the constructor tho
Is it possible to open a virtual book on bungeecord to a client?
https://www.spigotmc.org/threads/guide-beginners-guide-on-improving-your-codes-performance.396161/
Iโve been reading this article and could someone explain to me how figure 5.3 is faster ?
Because you avoid the square root call
But youโre calling it anyways by squaring in the variable above so isnโt it the same thing ? Maxdistance*maxdistance
Lol true
In math itโs practically the same thing just smaller syntactically. So how would the root call be slower than just the multiplication ?
how do you go about finding the square root of 7?
does somebody know how i can spawn this swing animation? ( the effect triggered if you attack with a fully charged sword )
Not to mention that not only are you avoiding a root call, you're avoiding n root call_s_. There are multiple calls to Math#sqrt(). One is bad enough, let alone n lol
Especially when you really, really do not need that operation. You're simplifying the math required to get to the same outcome
Only time you should be getting the distance over a squared distance is if you're showing it to the user
mm lovely
That's certainly one way to do it
saving muh cpu cycles
hello
guys does anyone know how to cancel items that i get from fishing rod (except fish) ?
how do i get default stats of EntityType without spawning it and then instantly killing it
Could anyone help me with some world edit api stuff?
https://pastebin.com/B69NttAg
https://pastebin.com/ssuaJCu1
First is code, second is error
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
cant tell without the rest of the class
Its not fully written yet,
islands.remove(playerId);
}
public Island getIsland(UUID playerId) {
return islands.get(playerId);
}
public void teleportPlayerToIsland(Player p, World island){
Location spawnLocation = island.getSpawnLocation();
p.teleport(spawnLocation);
}
}```
i meant the imports and package lol
its probably easier
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I had some issues with incorrect bukkit/worldedit imports but I thought I cleared all that up
im guessing that issue is with we internals so you might wanna ask in their discord
eek chatgpt said the same I was hoping it was just my syntax D;
how do i get default stats of EntityType without spawning it and then instantly killing it
probably a virtual entity from the recent snapshot
Thank you by the way!
wdym by virtual entity
recent api adition to make an entity without spawnign it
i can't find it
reflections?
or just cache it
uh how am i gonna cache it
im tryna avoid spawning it
World#createEntity
create entity doesnt spawn
declaration: package: org.bukkit, interface: RegionAccessor
oh
i see
Note: The created entity keeps a reference to the world it was created in, care should be taken that the entity does not outlive the world instance as this will lead to memory leaks.
What does this mean?
when the world gets unloaded its references should be removed, but by something keeping a reference, eg you saving the entity after the world is unloaded will keep that in memory so you have a memory leak from it not being able to remove the world from memory
how do i make it so that it doesn't outlive it then
keep a weak reference
is that even necessary tho
i mean like wouldn't the class just get dropped when its out of scope
it tries to but if something holds a reference it wont remove it
wdym if something holds a reference
private World world = Bukkit.getWorld("name"); would be holding a reference
ah then ig in my case nothing would be holding a reference to it
the entity holds a reference to it
since it will be only used to get default stats of a mob
but if you dont hold an entity reference in more than just a method u'll be fine
Yeah
Sort of
in Rust u have borrows and lifetime
Java has a gc that actively checks if variables fell out of scope
seeds are a string right?
probably some kind of int
im reading the wiki.vg and for the login play packet, it needs to send the first 8 bytes of the sha 256 hash of the seed
Think they are just longs in the end, no?
wetty palms real
i dont know
ill just search for a seed genreator in gh
wait how am i gonna get mobs default hp using that
i just realize i can't get attributes of Entity
entities dont have attributes
then how do i check default stats using that
that doesn't seem to exist in Entity
im guessing its on living entity which it probably isnt
yea its in there
so ig there's no way to get default value without spawning them first?
it might exist in nms otherwise you have to hardcode it in an enum or something
oof
@remote swallow how do i just check if Entity is a Mob
with the given EntityType
instanceof Mob
get entity class is assinable from Mob
but its EntityType will that work
so i need to use createEntity?
you are trying to get base attributes?
you can;t do that without NMS or getting an entity
is there a way to get mobs attributes without spawning an entity
like health of it etc
but it returns entity only
not LivingEntity
If you are creating it you know what it is. If you are only creating LivingEntities then cast the returned Entity
so i can cast it to LivingEntity?
i see
Sigma palms
Is it possible to change the width and length of a display block independently from one another?
I always only see blocks that are always in a 1x1 relation. Also, there's only a #setDisplayWidth and #setDisplayHeight, so I assume it is not possible. But I wanted to make sure.
Ah, it probably has to be done via scale
how can this be? I set the PrivateSystem class in the constructor, but when I get it I get null, and I donโt have a setter
show where you instance Kingdoms
I can't tell, cause there is no call to #getPrivateSystem there
public void playerType(ChatEvent event){
Player player = event.getPlayer();
KingdomsPlayer kingdomsPlayer = KingdomsPlayer.getKingdomsPlayer(player);
WaitingReason reason = kingdomsPlayer.isWaitingForInput();
if(reason == WaitingReason.NONE){
return;
}
if(reason == WaitingReason.KINGDOMS_NAME){
// TODO: CHECK IS KINGDOMS EXISTS
Kingdoms kingdoms = new Kingdoms(player, convertComponent(event.originalMessage()), plugin, kingdomsSQL);
kingdomsPlayer.setKingdoms(kingdoms);
player.sendMessage("ะะพัะพะปะตะฒััะฒะพ ััะฟะตัะฝะพ ัะพะทะดะฐะฝะพ ั ะฝะฐะทะฒะฐะฝะธะตะผ " + convertComponent(event.originalMessage()));
}
kingdomsPlayer.setEditor(!kingdomsPlayer.isEditor());
kingdomsPlayer.setWaitingForInput(WaitingReason.NONE);
event.setCancelled(true);
}```
public void createWalls(){
int chunkX = chunk.getX();
int chunkZ = chunk.getZ();
if(kingdoms == null){
Bukkit.broadcast(Component.text("KINGDOMS - NULL"));
}
if(kingdoms.getPrivateSystem() == null){
Bukkit.broadcast(Component.text("PRIVATE SYS - NULL"));
}
if(kingdoms.getPrivateSystem().getChunkSystem() == null){
Bukkit.broadcast(Component.text("CHUNK SYS - NULL"));
}
}```
why are you creating a new instance of Kingdoms on every chat message?
you are also accessing KingdomsPlayer before you instance Kingdoms and set it in KingdomsPlayer
Kingdoms is also a local variable which goes out of scope for every message
KingdomsPlayer looks to be some static mess which you repeatedly change teh Kingdoms instance in
why does the player bug into the block when i change the material of the block under him?
blockBelowPlayer.setType(materialToSwap);```
Each player has his own KingdomsPlayer, which stores information, editing mode, and the kingdom in which the player is in. In a static method I save a Map in which the player's kingdom can be retrieved/changed
why do you create a new Kingdoms object for every chat message and then set it in KingdomsPlayer. static again
noooo
every chat message you do java Kingdoms kingdoms = new Kingdoms(player, convertComponent(event.originalMessage()), plugin, kingdomsSQL); kingdomsPlayer.setKingdoms(kingdoms);
You should not create GUIs like this. Its is an absolute mess.
I was going to redo this, it looks too clumsy in the code
Somewhere (probably in KingdomPlayer) you are trying to access Kingdom before it is set
so hard toi tell as the code is a mess
I don't think that's the problem. For KingdomsPlayer, the kingdom is not null, which means that PrivateSystem should not be null
Your constructor should not have side effects, like registering itself in static collections.
This responsibility should lie with an external KingdomManager which is a singleton and
manages collections internally.
And never create a getter or setter for collections/maps.
Itโs just easier, you donโt have to pass the manager to the constructors every time
Are kingdomsList and nameKingdoms at least private, static, and have no getter/setter?
In this case you majorly broke encapsulation and finding the cause can be an absolute nightmare.
You can write a system in which you dont have to pass your KingdomManager through constructors.
Having manager classes as Singletons with a static getter is perfectly viable.
Try to rewrite this with a few rules:
- No static (Unless you have constants or singletons)
- No getter or setter for any collection. (No exception)
- Constructors dont have functionality. They only initialize the class. No side effects.
This will probably resolve all your "Something is null when it shouldnt" problems, as those
probably emerge from the mess which is created when you break encapsulation.
okay, thanks
Let me show you an example because the question about bulk operations often comes right after someone starts with managers ^^
Last method should be your go-to for bulk operations.
public class KingdomManager {
private final Map<String, Kingdom> kingdomNameMap;
public KingdomManager() {
this.kingdomNameMap = new HashMap<>();
}
public void addKingdom(Kingdom kingdom) {
String name = kingdom.getName();
Preconditions.checkArgument(!this.kingdomNameMap.containsKey(name), "Kingdom with name " + name + " already exists.");
this.kingdomNameMap.put(kingdom.getName(), kingdom);
}
public void removeKingdom(Kingdom kingdom) {
this.kingdomNameMap.remove(kingdom.getName());
}
public Kingdom getKingdom(String name) {
return this.kingdomNameMap.get(name);
}
public Set<String> getKingdomNames() {
return Set.copyOf(this.kingdomNameMap.keySet());
}
}
they are both
however in the case of it being a string it is limited to being an int
so if you use strings, it only has 32bits to work with and I forget the other case in where its also an int
otherwise its a long
yeah cuz of String::hashCode, or am I missing sth?
that is correct if I remember right
https://wiki.vg/Protocol#Registry_Data
Is the NBT Tag Compound just a string with the "json" object?
ah I remember the other condition
if the seed is greater then 20 characters it is also an int
private static KingdomsManager instance;
...
public static KingdomsManager getInstance() {
if(instance == null){
instance = new KingdomsManager();
}
return instance;
}
}```
so if I want to use singltones, I should do this? Or is it better to store the instance in a plugin class?
||(never used singletons)||
Both is fine.
Spigot is a bit odd in that regard, because initialization is done in your onEnable. But if you dont encounter any dependency
problems, then a classical singleton is ok.
Thank you! ๐
PS: you could use a ternary expression to shorten this a bit
return instance == null ? instance = new KingdomManager() : instance;
Because a variable assignment evaluates to the assigned value.
Preconditions.checkArgument seems confusing. I'd prefer a simple if statement so it's clear of what's going on ๐ค
Is there a quick way to check for a specifc block around a Location e.g. in a 2x2 radius or should I just iterate through them all
I find it less cluttering that a whole new block of code
Since which version are hex colors supported?
1.16
how to accurately check for memory leaks in a plugin?
You could use VisualVM or enable the garbage collection logging
or eclipse mat
for logging, add this to your server startup script
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<YOUR LOG FILE>
If I have two classes which both have the same event
If i set cancelled in one class' event, does the other also become cancelled
depends on priority and which you registered first
An event is a single object which gets passed to every EventHandler method, one after another.
So if one handler method before yours changes the object, then you will ovsly get this changed object.
So if there is entity dmg event
Class A is registered first
Class A's event does setcancelled
Does class B's event run at all?
My interpretation of all your answers is that it does not
Depends on if you have the ignoreCancelled flag set or not
by default yes. your second one would not fire as default is ignoreCanceled is true
Yes, cancelling the event doesnt change if it is passed to other methods.
But you can prevent getting cancelled event objects by adding the ignoreCancelled property to your
EventHandler annotation.
@EventHandler(ignoreCancelled=true) <- This will prevent Events, which have been cancelled, being passed to your method.
No
Defualt is false
Default
**
So it will run
ignoreCancelled marks the method to not run if the event is cancelled
So it โignoresโ ur eventhandler if cancelled
you are correct, default is false
The naming is ๐ฅฒ
yeah naming is a bitch
ignoreCancelled
boolean ignoreCancelled
Define if the handler ignores a cancelled event.
If ignoreCancelled is true and the event is cancelled, the method is not called. Otherwise, the method is always called.
Returns:
whether cancelled events should be ignored
Default:
false
Why I have such problem? When rendering a chunk, its PDC must be read, and based on the data, create a class for the chunk. I output the uuid of entities to the console, but for some reason it thinks that the entities are null. Although if you teleport to this uuid, then everything is ok
entities may not be loaded as the chunk is
how does it work? I thought when loading chunks the entities would be loaded immediately
Probably loads after ๐คท๐ฝโโ๏ธ
even so, uuid displays them, but does not allow them to be shown
entities have their own event https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/EntitiesLoadEvent.html
Crazy shit
hello, what packet do I send (and how) to show a fake player in a player's player list?
Oh thank you. I thought there were only chunks
Google it
Then try it
Then ask here for help when you fail
well, the only things im finding are either:
- for 1.8 or older
- just not working at all
- packet not existing anymore
- or use a 3rd party library
they are also quite old
?
This article is about the protocol for the latest stable release of Minecraft Java Edition (1.20.4, protocol 765)
link?
oh its wiki.vg nvm
The idea of what to send has not changed
ive tried sending a ClientboundPlayerInfoUpdatePacket with a game profile and ADD_PLAYER but it didnt do anything
This was what you should have led with along with the code that did not work btw.
Not โhow to do thisโ, but i tried โthisโ and expected โthisโ
adding to tab list https://github.com/dmulloy2/ProtocolLib/issues/262
using protocol lib
missed a digit
bud i submitted that
they answerd you
is there a way to set ItemMeta from a given ItemMeta String
that sets itemmeta with a given itemmeta string?
"{display:{color:3949738}}" for instance I have this
StringNBT?
mhm
Isnt there Spigot unsafe?
no
it seems like UnsafeValues is an instance how am i gonna use it
Bukkit#getUnsafe iirc
Bukkit.getUnsafe
ok thanks
What do you mean no? You just posted it 
sigh
strange, but it still didn't help.
@EventHandler
public void loadEntity(EntitiesLoadEvent event){
Chunk chunk = event.getChunk();
String kingdomsName = chunk.getPersistentDataContainer().get(NamespaceManager.getInstance().getKingdomsName(), PersistentDataType.STRING);
if(kingdomsName == null){
return;
}
Kingdoms kingdoms = KingdomsManager.getInstance().getKingdom(kingdomsName);
if(kingdoms == null){
return;
}
if(KingdomsManager.getInstance().getKingdomsChunk(kingdoms, chunk) == null) {
kingdoms.getPrivateSystem().getChunkSystem().loadChunk(chunk);
}
}
these entities continue to be null
get the entities from the event
also note the warning:
The provided chunk may or may not be loaded.
I still don't understand
in theory, the entities in this chunk have loaded, if I get the uuid of the entity from the chunk from the PDC, then they should not be equal to null
.
just save the list?
I just have to get entities by uuid from a chunk, and not everything in a row
After the event it should be safe to get them by uuid
May need to wait an extra tick
I'd get it from the event
since the chunk could get unloaded
probably won't be but better safe than sorry
Since when is this a thing holy shit??
Don't tell me it's always been there, I'm going to feel stupid
reasonably new
Is this gonna be a replacement for enums like Material or how does this work
I just happened to peak at the javadocs and saw this shit and was like wtf I haven't seen this
Wait, but it's not new, it's there since at least 1.16.5
ItemType and BlockType will be the replacement for material
Ok it seems it's there since 1.14. How has it been able to go under my radar for so long lmao
I see
I did say reasonably. I guess 1.16 is getting old now
When approx is that coming, any idea?
Haha
Welp it's there since 1.14 and that is DEFINITELY old ๐
no clue
anyone wanna make a minecraft server framework in rust together
from scratch
for latest version
hehe
and best performance ofc
๐ณ
If I had more time on my hands I'd join in lmao
But even then I'd need to get my Rust up to speed, I haven't done anything with it in so long
I mean I'm not the best at rust either
I'm a noob
lol
yeah I can try to contrib
How good are you at rust?
I don't want to be criticized for my skill
You learn by making stuff
well Im almost proficient
hmm
how much can you contrib?
kinda boring doing alone
well i mean Im willing to give my opinion on w/e happens, but like, since im going on a trip to usa I wont be able to do much the coming month
also the
feather
I mean It's fun
to make a server
rust is a new language, and new stuff is always fun
java is slow old and boring
i mean its not that new
rust is actually enjoyable writing code in cause you know it's worth it
yeah true
I mean still, I find it quite enjoyable
and the magic is also fun
Haven't used it a lot though, if we build a server I'm sure it'll be used a lot
and if we do make a server, the physics would be fun to code
and something to put on my undergrad application
anyway, those who do you want to contribute to this amazing project, please dm me as I will make a group chat
good luck
i mean its a really huge project
It's probably a million lines of code big lol
so like, dont expect a finished product
whats the name of site for the comparing mappings
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
ty
Ur gonna be slaveworked now
https://paste.md-5.net/zibatoduke.sql
so i 've been having this error with mostly minecraft 1.16.5 can't figure out what's causing it though can someone lend me a hand its a mc pluing
pom?
pom.xml
and how are you compiling the jar
intellij
.-.
sorry if i am missing the point i am not too good with explaining or exact understanding ;-;
is this your first time programming in Java
yeah i am learning from the video and i am doing what it showed but as you see idk what's going on in the error
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
You should learn basic Java before starting with Spigot
i did though that's the thing
Try deleting C:/Users/sasam/.m2/repository/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.jar
and then building again
nope error again
Same error?
just checked yes
um, are you online? Disconnected from the target VM, address: '127.0.0.1:64163', transport: 'socket'
Debug mode in Intellij can do that
ok
this doesn't require internet
it happens when the debugger is shut down or the debugged process is shut down
a build does if he's never built before
i did with basic java code so i know how to build
[[nycmen,false,[none,none],[nycmen,none],[none,none],[none,none],0],[tokyo manji,false,[none,none],[tokyo manji,none],[none,none],[none,none],1009],[yomen,false,[none,none],[yomen,none],[none,none],[none,none],2555]]
i have a list like dis
how do i sort it based on the l[i][l[i].length-1]
hey is there any easy way to check if player is muted? (without hooking into bans plugin's api)
No
it is extracted from a db
I assume the muting system stems from a plugin?
Well you could probably force the player to send a message
and then see if that is intercepted
but that's just a bad way of doing it
I think you need to provide more context to what you want to achieve
if it comes from an sql query you can add a sort on that
Ok thanks!
the best way to do it btw is to create an ordered index for balance
if your database supports that
i will see to it and the ORDER BY works!
whats that
A plugin is what youโre writing
When he says bans stem from another plugin he could be talking about any sort of administrative plugins
Then you need to implement your own functionality in order to cause someone to actually be muted, ie: if player isMuted(){
E.setCancelled(true)
}
Something like that
Perhaps try storing a player uuid to an array list so when a mod or something on your server types /mute <player> it will store their uuid in a list which you can then use to check if the player is muted
If that list contains their uuid then make a chat listener event class and just implement the simple โmutingโ logic there
Does anyone know how to get item's burning time?
fuel time for cooking recipes?
no, like fuel's burning time, like how long would burn coal, oak log, etc. in furnace
yeah thats for cooking recipes lol
I found only Material.isFuel()
hmm all I see is furnaceburnevent exposing anything related to burntime
and ofc the Furnace blockenetity
oh... I'm creating something like another block with other funcionality with burning mechanic so... I think furnaceburnevent isn't my option
net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity.getFuel() otherwise from nms
I'm not sure that I know how to use it...
is it possible to save a mutable list to a pdc?
myeah
i mean the elements of the list would get copied essentially
so if u mutate the original one, it may not reflect
so how would i create one?
Just save normal array list lol
new ArrayList<>() maybe, or LinkedList
but there is not persistentdatatype for this, right?
is it easy to create my own type or should i just use these libs?
Save time by using lib
Creating your own types should be not too hard if you have experience with serialization.
But adding PDCs to something that has none in the first place is quite cumbersome.
Can someone help me with some world edit api?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
okay, is there a lib that you can recommend?
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
https://pastebin.com/iVw2RyZr
The issue is that my schem is not being loaded to the world on creation, although the world creation itself works fine
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
any errors?
Nope
There's just no schem being pasted to the world haha
The really interesting part is that I was having issues with reading the schem file but that was because it got corrupted... once that was fixed, world creation worked but no schem was loaded
Try printing and see if it fires the paste code
} else {
// case when the block at the specified location is not a chest
System.out.println("Chest not in correct location in schematic!");
}
this gets printed to console
but that's it
im not coding an mute plugin
Try using the bukkit adapter instead of creating a new bukkit world
I thought I tried that... let me see
Well in order to detirmine if a player is muted or not you have to either write the mute logic yourself or be hooked into someone else's admin plugin
I'm 98% sure there is no basic bukkit method for if the player is "muted"
I have an idea. ill store muted players in muted.yml (with "admin types /mute" logic) and excluded them onMessageSend event if the are in config (muted players cannot send messages)
You could achieve the same thing with an arrylist method
then just use someone elses api bruh
What is your overall plan. Simply not send messages if a player was muted by another plugin?
You're trying to create more work for yourself with that method imo
nope. im trying to:
If player is muted and he swears in a book, sign etc. not to mute him because he may have 7d mute and im trying to mute him for 3 hours. that will only decrease the duration of his mute.
It's supposed to be an antiswear plugin which I'm not sure why he needs to check if the player is muted... couldn't you just check for strings?
and im trying to prevent that
This requires you to have access to an admin plugin or just write the logic yourself because there is no basic bukkit method that implement administrative properties such as muting a player, you'd have to write that logic out yourself... or just use another api imo.
I dont understand this sentence...
if player swears or advertises on a sign:
if playerIsMuted() {
dont mute him because he maybe is trying to decrease duration of his mute
} else {
mutehim;
am i clear
Ehm
so why would muting again reduce the total mute time
yeah
instead of adding to it
litebans ig?