#help-development
1 messages · Page 718 of 1
nice
https://paste.md-5.net/usezayedit.java
I can't get the npc to rotate. I've tried a lot of things and have been working on this for the past 2 hours and nothing works. It just doesnt do anything.
Why are you on my D
leave me alone G
don't you have anything better to do with your life
no not really
biggest bomboclaat
real java is a single file that starts with void main(){ :kekw:
so using an api isnt real java, got it
so writing code in java that works with other code written in java
is not real java
thanks
understood
you should look at mfnalex lol
help me how to save myself from a terrible technical task
morbius
f u
I ain't got public stuff to flex about.
I found a tampermonkey script to bring github back to the old feed
I do use github tho
Morbin time
i too
👀 link?
Replace the shit💩 new feed with the old one.
wtf is this
what you mean "old feed"
im about 95% sure i could write that faster in actual java
new feed is just the "for you" page
This is the first Skript I ever coded years ago before I took classes on coding.
or knew a thing about coding
i dont think any of them you would use in plugin dev
k
huh there's no 'open recently closed tab'
hm
there's a reason for that, I'm doing helper methods to apply specific types of values to specific keys
one sec
public static <T, Z> void applyPDCTag(ItemStack item, String key, PersistentDataType<T, Z>, Z value)
i think
my generics are in the wrong place
goes before return type
might be modifier too
ah yea wrong place
gosh learn java epic
it wants a identifier now
stick generics before static after public
ah in the later part
it seems to work if i actually add a variable name to the pdc type lol
yeah that does help
ikr

interesting way it recolors this btw
dafuck?
key already define
but I've expected it to keep the syntax higlight and just mark the key as 'error: key already defined in scope'
i would also recommend using NamespacedKey.fromString("namespace:" + key)
No use the plugin
oh wait the plugin one isnt deprecated its a string one
swear the plugin one was deprecated
yea thats what im doing there
i figured keeping it in a static variable is faster than doing Bukkit.getPluginManager.getPlugin
DI 
my brain isnt working so why shouldnt i go jank some stuff together
Ah
it is also unused in this case so it makes sense
this be a final class of helper methods
ive a package for em
if i wouldnt put out some things into final 'library' classes some other classes would get unreadable
Uppercase package name 🔫
yea im aware, im just used to doing things this way
personal naming conventions sound like a really great idea dontcha thinkg?
dont worry the top-level part of my path is lowercase
How to combine text components and strings in one BaseComponent in order to add page with some clickable text?
is there a spigot post that just simplyfies Enchaments so it say like DAMAGE_ALL = Sharpness?
getKey().getKey() on the enchant
what are you trying to do
not suck
it takes a single string but you have commas
TextComponent withSign = new TextComponent("§2X");
TextComponent withoutSign = new TextComponent("§4X");
BaseComponent[] result = new ComponentBuilder("[", withSign, "]", " ", "[", withoutSign, "]").create();
commas denote arguments
oh u meant warrio
what arguments are you trying to add
seems like a time for a plus
nah I mean so I dont need to look for everyone I need to add to an item
like i have 2 text components with click and hover event
or .append or whatever actually takes a component
oh
I want to do something like this:
TextComponent withSign = new TextComponent("§2X");
TextComponent withoutSign = new TextComponent("§4X");
withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign"));
withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign"));
BaseComponent[] result = new ComponentBuilder("[", withSign, "]", " ", "[", withoutSign, "]").create();
newBookmeta.spigot().addPage(result);
but i don't know how to combine text components
and strings
?jd
Create text components
And append them
public static <T, Z> void applyPDCTag
Is it possible to change this so that 'Z' is a return type?
I want to query PDCTags as well
public static <T, Z> Z applyPDCTag
ah its supposed to be a separate method but thanks
do i need to declare what Z is somewhere?
its declared in the <T, Z>
Z can be anything atm, you can customize what it would be tho
So i have another problem i have 3 text components 2 with click and hover event and 1 don't, but he extends click and hover event from text component behind it, how to clear click and hover event from this component?
TextComponent withSign = new TextComponent("§7[§2X§7]");
TextComponent withoutSign = new TextComponent("§7[§4X§7]");
TextComponent space = new TextComponent(" ");
BaseComponent[] hoverWithSign = new ComponentBuilder("X1").create();
BaseComponent[] hoverWithoutSign = new ComponentBuilder("X2").create();
ComponentBuilder result = new ComponentBuilder();
result.append(withSign);
result.append(space);
result.append(withoutSign);
newBookmeta.spigot().addPage(result.create());
each component handles its own click and hover, you then combine them with the builder
like how?
TextComponent message = new TextComponent("Click me");
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org"));
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Visit the Spigot website!").create()));
ComponentBuilder builder = new ComponentBuilder();
builder.append(message);
bookMeta.spigot().addPage(builder.create())```
yeah but i did everything like this
TextComponent withSign = new TextComponent("§7[§2X§7]");
TextComponent withoutSign = new TextComponent("§7[§4X§7]");
TextComponent space = new TextComponent(" ");
withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign"));
withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign"));
ComponentBuilder result = new ComponentBuilder();
result.append(withSign);
result.append(space);
result.append(withoutSign);
result.append("\n");
result.append(page);
newBookmeta.spigot().addPage(result.create());
but space and "page" extend click and hover events from withSign and withoutSign
@young knoll component man wake up
._.
Is this bro really a master of components?
knows more than i do
i check when player moves and cancel the event:
public void onMove(PlayerMoveEvent e) {
if (e.getFrom().getZ() == e.getTo().getZ() && e.getFrom().getX() == e.getTo().getX())
return;
but even if i just look around it gets cancelled
floating number operations go boom
I have a problem with my minigame plugin i am trying to create 1 game with:
System.out.println("Games created");
if (!gamesCreated) {
if (GameInfo.getGameByName("PublicGame #1") == null) {
GameInfo.createGame("Public Game #1");
}
gamesCreated = true;
}
}
public static boolean areGamesCreated() {
return gamesCreated;
}
public static void clearGames() {
games.clear();
gamesCreated = false;
}
public static GameInfo createGame(String gameName) {
for (GameInfo game : games) {
if (game.getGameName().equalsIgnoreCase(gameName)) {
return null;
}
}
int gameId = getNextGameId();
GameInfo game = new GameInfo(gameId, gameName);
games.add(game);
return game;
}```
OnEnable:
``` public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
getServer().getPluginManager().registerEvents(new ClickListener(), this);
getCommand("points").setExecutor(new PointsCommand());
getLogger().info("OorlogSimulatie plugin is ingeschakeld!");
PlayerPoints.loadPointsData();
if (!GameInfo.areGamesCreated()) {
GameInfo.createGames();
getLogger().info("Games created");
} else {
getLogger().info("Games are already created");
}
}```
But its registers 2 times so it makes 2 games of Game #1
I don't think it does register it two times. But you're logging "Games created" twice
Also you're missing a space in your createGames() method. getGameByName() and createGame() are being passed two different strings
I have like a GameSelector and in it says Games #1 2x times and also made a system.out.print to check how many times a game is created and it is created 2 times.
But thank you 🙂
can somebody help i don't known what event does that if you spash a linger posion like instant damage it will flag it because i want make it so it dosen't hurt you
I had soe question related with components, why there is a point where colors are not applied anymore?
?
Yeah, havent you seen that?
You talking about when it goes on a new line?
One thing like that has happened to me before
yeah, the color doesnt appear after some amounts of characters
On the first line there is no problem, but then i think after the 2nd or after the middle of the 2nd one, the color doesnt appear anymore
Do you have code where this is broken in?
What do you mean with it?
I simply using player.spigot().send(component) and a normal component from the api
Could you show me how you're creating this component?
Kk
Because if you're trying to use ColorCode mixed with components, that's when it breaks.
You have to set the color using the actual API instead
They're just not supported together. Legacy chat api, and the new chat api.
They don't mix
oh okay, so color codes are new chat api
ColorCodes are old api (Ex. ChatColor.translateAlternateColorCodes('&', "&6Hi")).
To use the new one, you must set the color of the components using -
TextComponent username = new TextComponent("ignPurple");
username.setColor(ChatColor.PURPLE);
player.sendMessage(username);
As seen here - https://www.spigotmc.org/wiki/the-chat-component-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
This is a question about NMS, I hope this is appropriate here. I'm trying to get a list of all the world features (like the one when you type /place feature ). Looking at the NMS source, I can see that this list is produced by ResourceKeyArgument.key(Registries.CONFIGURED_FEATURE), however ResourceKeyArgument.listSuggestions gets this list from the CommandContext (CommandContext.getSource().suggestRegistryElements(this.registryKey), ...)) which I don't have and that gets it from IRegistry.getTagNames() and I can't find a way to get an IRegistry instance for a ResourceKey either. How can I get a list of registry elements from a ResourceKey?
well getTagNames will just get you the tag names, not element names
you can get Registry instances from a RegistryAccess which is available on Level
In fact, I'm confused because ResourceKeyArgument passes a ResourceKey to suggestRegistryElements which takes a IRegistry and ResourceKey doesn't extend/implement anything??
the ResourceKey passed to suggestRegistryElements is the ResourceKey for the Registry itself, not an element in the Registry
that's why the param type is ResourceKey<? extends Registry<?>>
Oh strange
I still don't understand how that works though. Because even if ResourceKey has a parameterized type of Registry, how can it be passed to a Registry unless it itself extends it or you take the value from that resource key
Like, I can't pass a List<String> to a String parameter..?
Nevermind I'm dumb, I've just realised there's two suggestRegistryElementss 🤦♂️
you don't pass it to any Registry, its the key for a Registry in the root registry of registries
https://paste.md-5.net/usezayedit.java
I can't get the npc to rotate. I've tried a lot of things and have been working on this for the past 2 hours and nothing works. It just doesnt do anything.
Yep, I was just looking at the default definition 😛
how much dedicawted wam should i have for a survur?

@echo basalt Do you have any insight on this?
why not just use citizens
I wonder if we're having loss
or any other npc library
citizens' codebase is a clusterfuck
let him play around
also yeah looks like probably a rounding issue
if I were to just use libraries instead of making my own stuff over the past 7 years I'd have like half the knowledge I do
that 256/360 is sketch too
protocol limitation ¯_(ツ)_/¯
yeah but 256/360.0 is different
¯_(ツ)_/¯
I mean thats always 0
that's the suspected problem
I mean, inputting anything into the value changes nothing
And multiplying by 0 is also always 0
even when the value is indeed like 10 or something
because 256/360 is 0 and then you are multiplying by 0
lemme open up my test project
How should I round it? This is from a video by Kody Simpson iirc
works fine on his end
256 or 360 need to be a float
No idea what you are doing with your ints
hmm prob a 1.20 thing
it has always been a byte since I started working with packets
how do i make ppl glow but only i can see them glow
Wait i thought he was emulating a player
I have a class for this shit with protocollib
rly can i see
I'm making a client side NPC
as the picture is for server I think
Ah in that case you need the 1/256 th rotation
it's inconsistent and botched together after a coding session that lasted like 3 days
but it works and I couldn't care less
What calculation would that be?
public void look(int npcId, @NotNull Player player, int yaw, boolean onGround, @NotNull ServerPlayer npc) {
ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
ps.send(new ClientboundRotateHeadPacket(npc, (byte) ((yaw % 360) / 256.0)));
ps.send(new ClientboundMoveEntityPacket.Rot(npcId, (byte) ((yaw % 360) / 256.0), (byte) ((yaw % 360) / 256.0), true));
}
can we please reuse variables
public void look(int npcId, @NotNull Player player, int yaw, boolean onGround, @NotNull ServerPlayer npc) {
ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
byte protocolYaw = (byte) ((yaw % 360) / 360.0) * 255;
ps.send(new ClientboundRotateHeadPacket(npc, protocolYaw));
ps.send(new ClientboundMoveEntityPacket.Rot(npcId, protocolYaw, protocolYaw, true));
}
pretty sure we're meant to multiply by 360
instead of just dividing
as we're downscaling a range of 0-360 to just 0-255
that's the correct math
Wait bytes only have 8 bit. 127 -> -128
That wont cut it
Yes you are right. We need to project a range.
I just woke up 🙂
it will
it's how it's intended to work
each value in the range corresponds to 1.4deg
So you just overflow on purpose
this is too confusing for me at 3am lol
which is lossy enough
uhh no
we have loss on purpose
float deg -> byte (unsigned)
0º -> 0
90º -> 64
180º -> 128
270º -> 192
If you have a rotation from 0 - 256 then you need the sign bit in order to represent all values
type deal
it's a ~1.4 : 1 ratio
aka 360 / 256
just trust me on this one I've been fucking around with packets since 2020
270º -> 192 and how do you imagine 192 would look like as a byte
it's just.. unsigned
The code you provided doesn't do anything for me...

lemme find my fakearmorstand code
probably in my gist
no clue why I used rotation
ppl at work deleted my fakearmorstand class 
here we go
Old Protocollib send is garbage

this is like 3 year old code
also yesterday I learned that do-while and while are different things
where the do block runs once before running into the condition
do while so nice for atomic impls
saw it on russian programming instagram
I very, very rarely use head iterations
it was a c++ in 5 minutes speedrun
Ok so it still doesnt seem to work. I'll try to look at some npc libs
https://youtu.be/WGKHnVsLndA?si=UPniPQIbl1Bozmh9&t=134
(earrape warning)
learned it here
Ah yes. The language where you have to implement the big 5 by hand every time and
where there are different files in which you write your implementation depending on
if it is compile time interlaced (fking header files)
I barely speak russian but I understood the video perfectly
Everything is standard C here besides the insertion operator
mm pointers
Ah didnt see the class in the end
homeboy is casually insane but yeh lemme add c++ to my CV
I hate that language. Rust superior
analog machines best
FPGAs
using your brain >>
Anyways, i think im gonna write my own game for a while... bb
rip
it's like 2:30am and I'm tripping about this one project
where I gotta project a shape into a wall and I'm dying out here
what the fuck is minecraft:__reserved__
someone let the python dev make a namespace
going off this thread, it's discussed that players can join a bungeecord proxy with a "unix domain socket" which is why ProxiedPlayer#getAddress() is deprecated. if the player joins and the socket returned is not an InetSocketAddress, what other object may it return, or what will the IP look like when printed?
DomainSocketAddress probably
that doesn't appear to be a bungeecord event, and I can't see a method which returns anything (in the event) about ips apart from the servers own virtualhost, assuming you were referring to either PreLoginEvent or PostLoginEvent
I see, what case would a domainsocket be used over an inet, and is it frequent?
but .tostring'ing the socketaddress gives the \141.241.415.123:29104 etc though
Is there a more concise way to convert a Bukkit Location to an NMS BlockPos? I know it's not that long but just curious :Pjava new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ())
thats the best way in terms of avoiding craftbukkits version specific stuff, otherwise CraftLocation.toBlockLocation(location) afaik
Oh thank you, ye that's better!
can someone help me with java vectoring i will legit give you $1 if you can help me implement a feature in my code o_o 😦
As the message says, Unix sockets. And no, pretty rare
Just do instance of InetSocketAddress else unknown
Just ask your question
This code works perfectly fine and normal, however I want it to place the entire model in that direction the provided face variable.
For example, lets say I'm looking straight down at the model
X X X X X
X X Y X Y
X X Y X Y
X X Y X X
X X X X X
If I am facing EAST (which following the common way of a compass it should look like this.)
X X X X X
X X X X X
X Y Y Y X
X X X X X
X X X X X
Map<Vector, BlockData> blockDataMap = new HashMap<>();
for (Map.Entry<Vector, BlockData> entry : this.blockDataMap.entrySet()) {
Vector originalVector = entry.getKey();
BlockData originalBlockData = entry.getValue();
int rotations = face.ordinal() % 4; // Limit to 0-3 rotations
Vector rotatedVector = originalVector.clone();
for (int i = 0; i < rotations; i++) {
double tempX = -rotatedVector.getZ();
rotatedVector.setZ(rotatedVector.getX());
rotatedVector.setX(tempX);
}
BlockData rotatedBlockData = originalBlockData.clone();
if (rotatedBlockData instanceof Directional directional) {
BlockFace facingFace = directional.getFacing();
directional.setFacing((facingFace.equals(BlockFace.UP) || facingFace.equals(BlockFace.DOWN))
? facingFace
: getCorrectedBlockFace(face, facingFace));
}
for (int i = 0; i < rotations; i++) {
if (rotatedBlockData instanceof Rotatable rotatable)
rotatable.setRotation(rotateBlockFaceY(rotatable.getRotation()));
}
blockDataMap.put(rotatedVector, rotatedBlockData);
}
return blockDataMap;
How do I get the orientation of a jigsaw block? I tried using the same approach used for blocks with a direction Directional blockData = (Directional) block.getBlockData(); blockData.getFacing()
but when I try to use this with Orientable it doesnt work since Jigsaws dont seem to be an instance of that:
Orientable blockData = (Orientable) jsblock.getBlockData();
So how do I get the orientation I see when looking at a jigsaw block with f3 ingame?
when i load up my plugin, i get this error from the server console:
[ERROR] [LegacyPluginLoadingStrategy] Could not load 'plugins/PlutoAddon-2.0.jar' in folder 'plugins'
it always worked in 1.19.4 but now that i updated it to 1.20.1 it doesnt work anymore, even if in my IDEA (inteliJ) it doesnt show any errors
Show your exception
here:
17.09 09:28:29 [Server] [ERROR] [LegacyPluginLoadingStrategy] Could not load 'plugins/PlutoAddon-2.0.jar' in folder 'plugins'
17.09 09:28:29 [Server] [INFO] org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:127) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:35) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.entrypoint.strategy.LegacyPluginLoadingStrategy.loadProviders(LegacyPluginLoadingStrategy.java:202) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:39) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.loadPlugins(CraftServer.java:508) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at java.lang.Thread.run(Thread.java:833) ~[?:?]
17.09 09:28:29 [Server] [INFO] Caused by: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName0(Native Method) ~[?:?]
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName(Class.java:467) ~[?:?]
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:123) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] ... 9 more
17.09 09:28:29 [Server] [INFO] Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketListener
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName0(Native Method) ~[?:?]
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName(Class.java:467) ~[?:?]
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:123) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] ... 9 more
You dont have protocollib on your server or your plugin.yml doesnt depend on protocollib
i have protocollib 5.1.0 installed, here is my plugin.yml:
name: PlutoAddon
version: '${project.version}'
main: net.plutocraft.plutoaddon.PlutoAddon
api-version: 1.20
authors: [Gizmo0o]
description: Simple addon plugin for PlutoCraft.
website: plutocraft.net
commands:
daily:
description: The /daily command.
permission: plutoaddon.default
permission-message: You don't have plutoaddon.daily
store:
description: The /store command.
permission: plutoaddon.default
permission-message: You don't have plutoaddon.store
discord:
description: The /discord command.
permission: plutoaddon.default
permission-message: You don't have plutoaddon.discord
nick:
description: The /nick command.
permission: plutoaddon.default
permission-message: You don't have plutoaddon.nick
hide:
description: The /hide command.
permission: plutoaddon.default
permission-message: You don't have plutoaddon.hide
@lost matrix
You are missing your dependencies
here is my pom.xml file:
i put all my dependencies in there
Not in your pom, in your plugin.yml
oh, how do i do that?
GUYS
I HAVE HUGE PROBLEMS
Why the f... is this not working? The randomizer for the mob drops works perfectly.
What kind of mess am i reading here?
Which method is this in?
What is CompressedListener?
Why do you create an instance of CompressedListener and then dont do anything with it?`
It's not the entire code just a snippet.
You dont say. But its an out of context snippet.
thanks so much! it works now!
I said the other one works perfectly, just read those lines after onBreak
You cant add items to this list and expect them to drop.
Oh
Also this is an absolute mess
No it's not... you didn't see the entire code.
I dont need to. Im seeing at least 5 things here which are either obsolete or straight up dangerous to your servers stability
Which ones?
Here are a few. And im actively ignoring that java code style violations.
The last one is actually useful, but if I don't write something else instead of the other ones, the code is going to work perfectly. The instance is not pointless, this entire thing runs in a method, so it is going to increase the readability. Never hold references to player object? Why? These things cannot be triggered without a player so... why not? This doesn't make that much sense actually... to make a separate variable for the block's type. For only two usages, you can clearly see, what is going on.
If you hold reference to player object, is gc able to clear it after player leave server?
1 word: memory leak.
Hm. I don't think so. Just add it to the other method.
So it will clear up
Hard references to Player objects is a common memory leak. Use their UUID instead.
Same goes for Mobs. And if you use an object more than exactly once you should create a variable for it, no question.
Cascading getters like that is unclean.
Exactly, that is how memory leak happens
Orrr just remove the reference when the player quits
Also Enum#values() might not be really cheap operation
Na good you just made it to explain me something. Hmm... I didn't think of the UUID. 🤣
I didn't find anything to get all of the materials.
What?
What?
There are tens of types of materials. What do you mean?
Cache Material.values(), don't call it on every event
Oh... 😂
Or at least just use it once.
Wait... is there some kind of a method, that checks if the material can be threw onto the ground?
Nevermind I found it, thanks for the help!
There is a list made by someone with all blacklisted items. https://www.spigotmc.org/threads/invalid-item-blacklist.232890/
Also using Material.values() should be cached too
That class is huge
Making copies of it is just not good
Ah yes
You talked about it
I made a separate variable for it.
Excluding all of these
Random can be cached too
It uses a low level array copy in the background. Only takes a few micros.
Once per BlockBreakEvent should be fine. Its even better if you cache it
on the heap instead of the stack, but thats a meticulous optimization.
But you shouldnt cache Random. Rather use the Random instance which is assigned to your thread by using ThreadLocalRandom
Why not?
Good to hear, Imma replace that
*Use a Set for this
I always cache my random
Why?
Ok but why not just use the Random instance which is always accessible on your thread?
I use secure random myself, it doesn't really mather what i use
Especially if you dont need to seed the Random
If you have a reason why i shouldn't use it you can tell me
Secure random? Because thats slow as hell.
Is it?
Does using this
p.setStatistic(Statistic.TIME_SINCE_REST,0);
``` stop phantoms from attacking you or how do they calculate when to spawn?
I use securerandom so my plugin is safe
Probably
Yes it needs an entropy source which can sometimes mean IO
thanks 🙂
I use it cause it's thread safe
Random is also threadsafe
Then you should def use ThreadLocalRandom as its designed for thread safety
What?
Oh , that's nice
Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded designs.
Oh, i always assumed thread local is optimized for the thread that makes the instance
Guess i was wrong
I remember seeing the bounded next int that was cool
I'm gonna use it then
Thanks
Goood
So it result in contentions, or race conditions. Doesnt really sound thread safe to me.
Might not be critical but still inhibited.
im getting this error when a player does /nick:
Every thread has a ThreadLocal Random instance. You dont create them, you just fetch them.
contention means lock contention, not race conditions
Sir this is Spigot
That's cool
So i shouldn't cache it
dOnT sENd tHAt PaCkET
The PlutoAddon is missing wrapper classes. I thought they where discontinued...
For ThreadLocalRandom there is no need. You can just get the instance for the current thread whenever 👍
Random random = ThreadLocalRandom.current();
wait so how can i fix it?
This is so cool
Shade the wrapper classes in or dont use wrapper
Does anyone know how to prevent nearby sugar cane from breaking ?
Can anyone tell me the use case of SplittableRandom
but this import here works:
<dependency>
<groupId>com.comphenix.packetwrapper</groupId>
<artifactId>PacketWrapper</artifactId>
<version>1.19.4-2.1.2</version>
<scope>provided</scope>
</dependency>
Prevent block physics from applying to the others. Might be a bit tricky.
I'm using this event but still the same
@EventHandler
public void onBlockPlace(BlockPhysicsEvent event) {
if (event.getBlock().getType() == Material.SUGAR_CANE) {
event.setCancelled(true);
}
}
provided means there is another jar which provides the classes on runtime.
But there is none. Means you need to bring those classes with you aka shade them into your plugin.
Change the scope from provided to compile
it works now
i just changed 1.19.4 to 1.20
to my understanding, it's like Random, but you split it for multiple threads; eliminating the synchronization cost of the normal Random, while retaining the deterministic nature
Its really just a ThreadLocal<Random>. Just in fancy.
it should be noted that random and threadlocal random uses 48 bits and uses the clock time for its seed generation. SecureRandom uses 128bits and needs a source for its seed generation to be provided. Main difference is that SecureRandom ensures that predictability is not so predictable where as Random and ThreadLocal is not concerned with this, you just need a random number
really
I don't think so
that makes different Random instances, so it isn't deterministic anymore
Yeah kind of. Just with a few more implementation details like automatic creation on thread forking
ThreadLocal<T> has seperate instances of T for each thread, same goes for ThreadLocalRandom.
for PRNG's like
L64X128MixRandom or L64X256MixRandom
you need a splitterator. These PRNG's are designed for applications that create many threads that are dynamic
Splitterator is basically for creating a splittable generator where the generation of the random is split between the threads
but the two PRNG's I listed are well balanced in terms of space, speed and period and are used when there is no special requirements needed. There is other PRNG's that exist as well, like a Jump generators or leap generators
Out of whos ass did you pull this now? Never heard of L64X128Mix.
Ah i see, some apache fkery...
Yeah, ThreadLocalRandom isn’t really good if you want to replicate behavior for per say testing or so, though you can always just make ur components depend on RandomGenerator instead and then mock it
And if you want single thread high performance PRNG
Xoroshiro128PlusPlus
Just return 1. Always. 
there is all kinds of PRNG's out there
some more secure then others, and others designed for a specific purpose or you can create your own with Java's RandomGeneratorFactory
declaration: module: java.base, package: java.util.random, class: RandomGeneratorFactory
you can create PRNG's based on charasteristics as opposed to just a named one
int NUM_PROCESSES = 100;
RandomGeneratorFactory<SplittableGenerator> factory =
RandomGeneratorFactory.of("L128X1024MixRandom");
SplittableGenerator random = factory.create();
IntStream processes = IntStream.rangeClosed(1, NUM_PROCESSES);
processes.parallel().forEach(p -> {
RandomGenerator r = random.split();
System.out.println(p + ": " + r.nextLong());
});
this is an example of L128X1024MixRandom PRNG
which is useful just like the one I stated earlier for many dynamic threads, but when you have millions instead
but you probably wouldn't reach millions unless you got some fancy server box that could support that lmao
no, these are prng's that exist in Java predefined
just have to name them as my code example above
if you want to use them
Java has like 11 or so prng's predefined
ah found the link where my code example in my snippet library comes from for those that want to further read
Random number generators included in Java SE are more accurately called pseudorandom number generators (PRNGs). They create a series of numbers based on a deterministic algorithm.
who know is it possible to make such a plugin? https://www.youtube.com/shorts/KjlSb3LWm8E
Ссылка на сервер - https://taplink.cc/denophine.jar
IP: dmc-minecraft.ru
Наш магазин ключей - https://t.me/dmc_store
Ищешь хороший хостинг? Мы пользуемся этим - https://my.pterohost.com/aff.php?aff=33
- Это шуточное видео и им мы не хотели кого-либо обидеть или оскорбить
Yes, resourcepack. This is probably done with ModelEngine or ItemsAdder.
The tool for modeling is BlockBench.
You can use display entities for this
You can also use falling blocks for this if you dont need to scale the blocks
But im not helping you more than that, for reasons
??
what are the reasons
how i can check rank in player? i mean use equals or this bad idea
rank is displayName
player well... is player
i want check displayName
exists rank or not
then split 💀
all rank plugins check so?
or create "group"
i use data file end display Name for interact with rank
but this bad idea maybe?
Guys i want to make like that but idk how anyone help ? place sugar cane without water
what does this even mean
When I give a rank to a player I just update his name and write the data to the data file - this is the essence of the rank but as I understand the others use groups to interact with ranks
I'm trying to make something like buttons, but i have some problems
TextComponent withSign = new TextComponent("§7[§2X§7]");
TextComponent withoutSign = new TextComponent("§7[§4X§7]");
TextComponent space = new TextComponent(" ");
withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign"));
withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign"));
ComponentBuilder result = new ComponentBuilder();
result.append(withSign);
result.append(space);
result.append(withoutSign);
result.append("\n");
result.append(page);
newBookmeta.spigot().addPage(result.create());
but space and "page" extend click and hover events from withSign and withoutSign
See if you can achieve this using the BlockCanBuildEvent
yeah? you have a group and the group has a mapped permission, said player gets granted said permission and now has the groups permissions
easier to just use luckperms and their api and or vault api
I have tried it before, but I don't think this is the correct way. I think there is fake water or something
But can such a problem arise - the visual part of the rank in the player’s name differs from the real one, how can I check this?
you shouldnt add the rank to the players display name
use placeholder api or a method for internal messages
so it's the same thing, no?
no
this add text in displayName too
for me you would make my display name RANK The__Epic, while you shoulnt ever be adding the rank to display name you should create the string as needed to not break most plugins that are expecting it to be a string with no spaces in it
wait you mean player.getDIsplayName shold be contains playerName no another text?
it should be the playername or a custom name you have applied, you can use it for other stuff if you know it will not break anything else
other plugin use player.getName no?
then how add visual
placeholder api or an internal method
"internal method" what you mean
a method inside your plugin that will either return the rank displayname/prefix for a specifed player or something to generate the name string that would then include the rank displayname/prefix
dont call updateInventory, its only for if the inventory is desynced
but if i will use placeholder api then you will still have to change the player’s displayName because there is no other way to display the rank
yes there is
you create an internal expansion and return the rank from offline player
No, there is a different method for that
you should have a way to do that, if not its screaming bad desgin
then you will still have to change the player’s displayName because there is no other way to display the rank" - sorry but i dont undestand wdym
no you wont
its like using luckperms
they dont modify the display name, plugins hook into luckperms api and provide a placeholder that they will then convert
or they support placeholder api, which luckperms can then convert to the rank string
declaration: package: org.bukkit.inventory, interface: Inventory
your rank plugin should store the uuid to rank identifier in some form of storage, even if its pdc you can still use that to not add it to the display name and let end user decide where they want the rank. Because most people dont want the rank of the player in a tp request for example
so luckPerms can get rank from player without using a data file? just taking it from the name
no it uses a database, it loads the data on player join
then uses either a hashmap, a caching lib or even its own caching
but there may be a mismatch between the visual part and the internal
what
it doesnt directly add it to the name because there is a load of different things it could add
and it wont hard code it
yes, it's just a "wrapper" for the actual specialsource tool
so basically the most official way of remapping you can get for spigot in gradle lol
👍 just saw you use it and my brain needed a bit to find the repo
where spigot javadoc
?jd-s
why cannot change nickname??
because your nickname wouldbe ur spigot name if you verify
i want to set like 'ditto (ping me on reply)'
you cant
:/
can we use that for displayName
but if i set my displayName to ditto (ping on reply), then all server's nickname changed
how do i make my player sit down? like the actual sit pose
so to disable pvp for a "team" should i use hit listener
or is there anything else
So could anyone help?
pleeeaaase
Summon a pig
i would dude but i don't know about text components sorry :( but someone else will
Or minecart
Ok :(
its probs the playerinteractevent
I don't think so.
is it possible to generate always the same uuid based on some criteria?
like some numbers (seed) or string?
I was only able to do it with the EntityDamageByEntityEvent
ok thanks
Why do you need to do this?
Can't you just store it?
huh i thought getClass acts like Enum
nah
because it has to be bound to a certain string
basically random, but with expected value based on X
guys, why not work? ``` listOf(
BlockEvent(),
DropEvent(),
InteractAdminEvent(),
JoinAndQuitEvent()
).forEach {
PluginBase.instance.server.pluginManager.registerEvents(it, PluginBase.instance)
}
You can't do it with the standard UUID class. I think you must to generate one yourself.
In this case, it's not registering the events
Isn't this showing any errors?
Okay. You need to create a new instance from these.
From every listener.
new BlockEvent() etc.
So, but I'm doing it in kotlin, so it's already instantiated
i recommend calling your listeners like BlockListener instead of BlockEvent
or BlockEventListener
anyways are you sure the code runs?
Yes, before I was using KOIN, but I saw that it wouldn't be good to use KOIN, so I took it out and instantiated it the normal way, but it doesn't work lol
koin should work if you use it properly.
Anyways: Tell us what exactly doesnt work
im trying to make a thing that lets a player sit like in gsit but i cant figure out how to do that
Create an invisible entity, preferably an armorstand, and mount the player on that entity
is that what they did in gsit
Probably
[10:34:42 INFO]: com.choice.admin.view.event.BlockEvent@2a565388 -> Instance
[10:34:42 INFO]: com.choice.admin.view.event.BlockEvent -> Class name
[10:34:42 INFO]: com.choice.admin.view.event.DropEvent@1e5875f1
[10:34:42 INFO]: com.choice.admin.view.event.DropEvent
[10:34:42 INFO]: com.choice.admin.view.event.InteractAdminEvent@5deb3791
[10:34:42 INFO]: com.choice.admin.view.event.InteractAdminEvent
[10:34:42 INFO]: com.choice.admin.view.event.JoinAndQuitEvent@20b74f47
[10:34:42 INFO]: com.choice.admin.view.event.JoinAndQuitEvent
So, Koin worked fine, but when I put 2 of my pl on the same server, it said that there was already a koin instance running (even using relocate)
now my problem is, I'm instantiating the events in the normal way, but for some reason the events aren't working
I put a logger in the forEach of the events, to find out what's going on there and it looks like it's being instantiated.
?paste one of the listener classes please
class JoinAndQuitEvent : Listener {
private val admin by lazy {
AdminManager.instance()
}
private val adminEvent by lazy { AdminEventManager.instance() }
@EventHandler(priority = EventPriority.HIGHEST)
fun joinEvent(event: PlayerJoinEvent){
val player = event.player
adminEvent.hideForNewPlayers(player)
admin.removeAdminMode(player)
}
Alright looks ok. Any exceptions in your console?
Did you add a debug message at the start of your event method?
no exceptions
Did you make sure the events are fired? log msg
Does PlayerItemHeldEvent have a simple way to obtain the previous and current item, similar to PlayerSwapHandItemsEvent? I can only find the slot ID
Which is basically as good as having the item, no? Just one more step.
i always feel iffy using inventory.getbyslot
cuz it always changes
like do i add 36 or not
bleh

huh

I cant figure out what you are trying to tell me
that i do not like using the raw slot IDs because i still do not know off the top of my head how inventories are structured
im fairly sure that without inventory view its hotbar, then the other three rows top to bottom, then armor, crafting, crafting result, offhand
Ah, i never had to add "36" to any slot, ever
but im not sure
But in this case you dont have to worry where the items are because you just have two unknown slots 👍
yea
want to delete temporary items if focus is lost on them
unfortunately there's no uniform itemFocusChangeEvent
leading to this monstrosity
?paste
the 'change' method in the abstract class is my focus point for that event
leads to some 'if event instanceof PlayerItemSwitchEvent' but at least ist ONE access point
What is focus? Thats not a concept im familiar with in the minecraft context.
like
if the item held changes in any way
stupidly enough ItemHeldEvent does not account for all those possible changes
hence the mess above
Why do you pass an generic Event to your change method?
I wouldnt do that. This just leads to a bunch of instanceof entanglement... Super dirty
again the idea was to have one singular access point
i know its not the best solution but its good enough
Its too generic. Specialize it more.
cant
can(t)
the only common superclass(interface) of those events is Event
Why do you need to pass an event in the first place?
to remove a item that's tagged as temporary, if it gets removed from the main hand
again no uniform event exists for that
for SOME reason
How about you pass the items or slots to your change method?
that might work, i still need to pass the event itself thorugh
cuz in other cases i might need to cancel it
this is just my current problem
Let the method return a boolean and cancel the event in the listener
if(change(player, items, etc)) {
event.setChancelled(true);
}
Or create an enum if you need a more granular result:
if(change(player, items, etc) == ItemFocusChangeResult.SWAP) {
event.setChancelled(true);
}
I'll check it now, I took the adminEvent from by lazy {} and put it in the constructor and put a log in the events
yea i can see how that would work. Should i make one change method with all args, or multiple if i only need specific arguments rarely?
probably one large method
You can create overloads if your change method with default values:
public boolean change(@NotNull Player player, @Nullable ItemStack previous, @NotNull ItemStack next) {
}
public boolean change(@NotNull Player player, @NotNull ItemStack next) {
return this.change(player, null, next);
}
ah i meant that in the class with all the listeners, i would probably call multiple methods
I criminally underuse method overloading
like if i do multiple methods with signatures, i need to call the one with all args, in that the one with less args etc
I know a few other criminals like that
I always forget it exists
Not sure what you are saying...
Anyways i cant skip leg day again
gtg
k
the events are ok, what is not ok is not my class manager, strange, thanks guys
oh I miraculously don't have any methods that need it
customModelData exists in entity?
no its for item
armorStand
but for npc model exists
because its items scaled?
what
its an item display that is transformed to be huge
I mean, somehow changing the name of an object can change the model.
yeah
bruh how
resource pack
i need use customModelData?
to change by name? no
no i mean customModelData load model too no?
Basically, a tutorial where Minecraft player/pack maker ShadowStrength teaches you how to rename items to change their models or textures depending on their name
This requires Optifine or the Optifabric mod to make, or else it MIGHT not work
I believe you replace the Optifine folder with Mcpatcher if you're doing earlier versions
If you have any...
thenks
i figured out, UUID class has a method that accepts bytes, i just made the string a byte array and it works great
no it's not reliable someone player just can change displayName
3d model can be load?
what
Ссылка на сервер - https://taplink.cc/denophine.jar
IP: dmc-minecraft.ru
Наш магазин ключей - https://t.me/dmc_store
Ищешь хороший хостинг? Мы пользуемся этим - https://my.pterohost.com/aff.php?aff=33
- Это шуточное видео и им мы не хотели кого-либо обидеть или оскорбить
how
most likely that will be a custom plugin that translates the info then uses block displays
how can a property change without it being interacted with
I'm a little confused as to whether there are tutorials on the subject.
there are
how is name
learn to use blockbench and then just lookup any custom model data tutorial
oh ok
and it’s difficult to make such a plugin like in this video, how many days will it take?
at your current stage that plugin would take you months to make
i dont think so
i do
I just haven't worked much with textures
because you have to decode the data and convert it to the custom model data, and you have to deal with vectors and movement
for you to make it from scratch it would take multiple months, if i was to do it it wouldnt take half as long because i have practise with a lot of the concept and i wouldnt be learning java along with making it
wait is the question if its possible to turn items into 3d models
because that answer is yes, easily
3 mouth?
for you
if your goal is to make custom mobs just use conxept model engine
I thought it was just loading the armor stand model
the video you sent wouldnt be
because you can move it and position it, which would require a lot of teleporation and transformations
what
Citzens
i'm loggin items into discord like this
but only move and pickup works, place doesn't
any idea why?
placing items is more prone to cause InventoryDragEvents over InventoryClickEvents
if you move your mouse even a little bit while placing the item, it's a drag event
even if only 1 slot is affected
show
oh
your click event isnt going because you're returning if the clicked item is null
that means if you're dropping an item, for which the clicked item has to be null, your logging stuff doesnt run
check if clicked item is null and if so take the cursor instead
if the cursor is also null you can return
so a && null check should be fine right?
and by the way, you should make a method checking if an item is null or air because this is sometimes different depending on server type
i believe spigot uses AIR for empty slots sometimes instead of null
yes
and you should make an itemstack variable for the item in question
ItemStack item = e.getCurrentItem();
if (item is null or air) item = e.getCursor();
if (item is null or air) return;
something like that
you can make it more compact if you want but eh
yea thanks
seriously though does anyone maybe have a clue on what i could be doing wrong
i just dont understand how the wrapper variable could have this property change when it's not being interacted with
at least not in a way that i understand
making a clone of it worked though i still have no idea where it got that edit
check your getCharges() code
its just a simple getter
and the getStoredEffects() method only fetches newly created wrappers from metadata so it shouldnt be getting any updates from there
just a getter? no other code in there at all?
nope
literally just a getter lol
charges is just an integer property and all this bit of code is meant to do is
get wrapper from persisted data
reduce charges by 1 on potion effect wrapper
update changes on persisted data
why are you storing it anywhere else than the PDC?
ok
i get the wrappers from the persisted data, i change the properties of those wrappers, then those wrappers are persisted back on the item
its increasing in your sysout so somewhere you must be increasing/decreasing the value
i should mention this output implies the change didnt reflect at all, the code is meant to decrease charges by 1 so it went from 8 to 7 in the method before
by the end of this method the amount of charges is 7 like expected
so its weird why it jumps back to 8 in setStoredEffect
the whole wrapper copy stuff fixed it, i guess
you're making a copy
even though that should be unnecessary
i don't know if the copy operates on your item meta anymore
because getStoredEffect already makes copies of those wrappers
what does .copy() do? as it's not clone
why?
because i dont understand or wanna deal with clonenotsupportedexceptions lol
well yeah i shouldnt need to here
but for some reason doing that "fixed" the issue
i know its just a bandaid but still
why's clone/copy bad though
because you have no need to operate on a copy.
metadata is always a clone so you cloning your data is already a copy
oh like that, no no
im reading/writing on one metadata here
the metadata is placed back on the item once all those edits are done
Is there any real negative to using PlayerChatEvent as opposed to AsyncPlayerChatEvent? I need synchronicity to run an InventoryOpenEvent
my plugin does a lot of individual item edits so this is done to reduce on the amount of getItemMeta() calls
yes it's put back, but metadata is always a clone so you shoudl not be .copy() your own data, just work with the object you have and ALWAYS put the meta back
i dont really understand your point
im confused because copying this property fixed the issue
its not a fix, its a hack
even though the fetched wrappers from the item's meta are already copies of their own
i know thats why i called it a bandaid lol
then remove it and find where the real issue is
somewhere you are not putting the meta back before you get a new copy
im... im asking for second opinions here
im not saying my "solution" was a good one
just to have extra thoughts on where the issue might be lying
we've not seen enough code to tell you what the fix is. we can only tell you what is not a fix
what did you mean by this? I'm not sure what I could set to empty
In your first section of code you pass both the meta and a wrapper. MY guess is your getStoredEffects is changing your wrapper reference
meta contains the unmodified value
your wrapper contains teh modified value
your first sysout displays 7 from yoru wrapper
you call getStoredEffects on the meta (NOT wrapper) and then wrapper is 8, so somewhere in your getStoredEffects you are altering the wrapper from the meta
"type": "minecraft:empty"
at the top of the json
turns out i was wrong when i said it was making copies of the effect when this data is fetched from the meta, so all these property edits were done on the registered effects rather than the copies
i am a fool and a fraud
i am more confused about your pfp
ignore it if you value not being pea'd on
why am i getting this error?
[17:45:43 ERROR]: Error occurred while enabling BowDuel v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.gizmo0o.bowduel.BowDuel.getCommand(String)" is null
at me.gizmo0o.bowduel.BowDuel.onEnable(BowDuel.java:11) ~[BowDuel-1.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-193]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-193]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:640) ~[paper-1.20.1.jar:git-Paper-193]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:551) ~[paper-1.20.1.jar:git-Paper-193]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.20.1.jar:git-Paper-193]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.20.1.jar:git-Paper-193]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-193]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-193]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-193]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
no command in plugin.yml
ok thanks didnt realise it was that simple lol
why is this not working?
public void onPlayerDeath(PlayerDeathEvent e) {
if(e.getEntityType().equals(EntityType.PLAYER)) {
Location hubLoc = new Location(e.getEntity().getPlayer().getWorld(), 20, 200,10);
// Winner
Player winner = e.getEntity().getKiller().getPlayer();
winner.getInventory().clear();
winner.setHealth(20);
winner.teleport(hubLoc);
winner.sendTitle("You won!", "GGs", 1, 1, 1);
// Looser
Player looser = e.getEntity().getPlayer();
looser.sendTitle("You lost!", "GGs", 1, 1, 1);
// Queuing system
first = false;
second = false;
}
}
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
when a player kills another player nothing happens
have you registered it?
and put an @EventHandler annotation above it
how come i’m unable to set a variable in class from a different maven module
ok that was it thank you
why is one of my lines like this?
just a comment, onlinePlayers is never going to equal 0
wait what why
i thought that would be when no players are connected to the server..
0 is a primitive value where onlinePlayers is a Collection of Players
ohh
try .size()
ok
or isEmpty()
How do I get rotation of entity?
you should also explicitly specify the generic type when introducing the variable
I don't think that would work anyways. Isn't the player still technically online during PlayerQuitEvent
yep
i dont think so
so you'd want to do onlinePlayers.size() <= 1
you pressed the sidebar, added debug pause
Get the entities Location. It contains the yaw of the body.
If you want the head rotation then you need the eye Location and its pitch/yaw.
im trying to mess around with mutli maven module projects, how do I share variables like Function<> throughout another module?
create another module
You need to add one module as a dependency in the other modules pom
that holds the interfaces
how do i get the player?
or if you can do that ^^
i did some math to make a small circle at the players chest, i want to like move it up gradually to be like a halo so it goes from the chest to above the head in an amount of seconds, how can i do that? java Location loc = player.getEyeLocation().subtract(0, 0.3, 0); for (double i = 0; i <= Math.PI * 2; i += Math.PI / 5) { double x = Math.cos(i) * haloRadius; double z = Math.sin(i) * haloRadius; loc.add(x, 0, z); player.getWorld().spawnParticle(Particle.REDSTONE, loc, 1, new Particle.DustOptions(org.bukkit.Color.fromRGB(214, 180, 252), 1)); loc.subtract(x, 0, z); }
I tried getting the instance of the other plugin via getPlugin() but that's returning a cast exception
hmm I did that but still no luck 😦
getShooter returns a ProjectielSource
You need to check with instanceof if its a Player and then cast.
lemme share some code
like this?
Nope
oh
And pls cache your variables:
ProjectileSource source = event.getEntity().getShooter();
if(...) {
Player shooter = (Player) source;
}
type matching is even better if you can do java 17
*pattern
that
I have two classes that are actually important, the FartManager and joinEvent, fart manager just has the variable, and JoinEvent uses the variable. ```java
@EventHandler
public void onJoin(PlayerJoinEvent p_playerJoinEvent) {
Bukkit.getLogger().info("Player joined");
if (FartManager.getMfw() != null) {
Bukkit.getLogger().info(FartManager.getMfw().apply(p_playerJoinEvent.getPlayer().getName()));
}
}```
The event fires, but when I set said variable in the core's onEnable, the variable is still null. ```java
@Override
public void onEnable() {
// Plugin startup logic
FartManager.setMfw(p_s -> "DUDDE, " + p_s + " farted");
}
interesting plugin idea
im just trna learn maven modules
anyone ^_^
im pulling words outta my ass
literally
Just create a few circles after another and then spawn them on different ticks
Are your modules all spigot plugins?
Yep, same verison and everything
Oh is that what im doing?
kek
its always that
i knew that
i remember already having this same problem with that solutino
UGHUEHGUAEH
Your problem kind of smelled like that.
pun intended
and that fixed it
It just reminded me of the classic ProtocolLib problem where the static getter of ProtocolManager returns null.
Happens if ppl shade ProtocolLib.
schedulers
i figured it out
well shit I'm late
it's ok
btw am i able to use your glow tracker in my code
sure whatever go for it
I feel off not having a pic of myself as my pfp
I'm surrounded by ppl with their selfies
I would just sell it...
its okay I'm here for you
how to add code here
😆 👉
?paste
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
mine's not an anime pfp
ik
?paste
WHAT ANIME IS YOUR PFP FROM 😢
joe
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
looks good
I would sell that as well
5$
justified
is there an event for when a hopper checks if the block above it contains an inventory (if that's how hoppers work)? i want to make a custom block which hoppers can take items out of
i can't find one, only the inventorymoveitemevent
Wait, are you from Kazakhstan?
Thats rare
7smile7 about to start flexing his 2 words he learned in uni
Was just seeing your flag ^^
marhaba
if it makes you happy I'm portuguese originally from moldova 
mountains, motherland of apples
declaration: package: org.bukkit.event.inventory, class: HopperInventorySearchEvent
good
thank you 7smile7
Isnt that just spain?

sure
same way moldova is just romania
nope, portugal
Might visit moldova one day
it was a shithole last time I was there
I would wait a bit with that. A bit close to a certain conflict right now.
all CIS is shithole now
Gosh, shouldnt think about that. Makes me sad and mad already...
i want relocate to eu after ending my study
for that reason
My guy pointing 200km from Odesa and calling it safe 
¯_(ツ)_/¯
it's a tiny village in the middle of nowhere
no wifi, no roads
nothing to bomb
Sounds like a perfect location for them. Civilians are the prime target it seems.
each bomb costs more than the whole net worth of the village
