#help-development
1 messages · Page 719 of 1
seems like an economical disaster
facts xdd
last time I was there we had a hole in the floor if we wanted to go take a piss
and if you wanted to buy any goods you'd take the weekly bus at 6am for a whole like 10 cents
why particles are exploding everywhere when i spawn them?
set the velocity to 0
just add ,0 ,0 ,0 ,0
you'll be fine
Ah, and they have been very ecological with their resources so far.
biodegradable bombs or what
from a home-made plugin, is there a way to detect any fluctuations in a player's essentials balance? (installed plugins: essentials, vault, quickshop)
Wait. What is the english word for ökonomie.
thanks
economy?
the ghetto way of doing it is just making a proxy class that logs stuff
I mean. Economical isnt a word, is it?
it is
it is
night trains
thing is literally everyone I met online lives like incredibly far from each other
Ozapft is currently where i live
Doesn't Vault globalize everything related to essentials' bank account?
vault is just a standard api thing that essentials hooks into and makes its own impl
Vault is a service for communication between one economy provider and several economy consumers.
Just ask...
that doesn't even appear on the map
so to get the account fluctuation I'll have to listen to the essentials plugin on send/receive money events (then get the total amount of the account after event) and listen to the quickshop plugin for buy/sell (then get the total amount of the account after event)?
just make a proxy class ffs
public class ProxiedEconomy implements Economy {
private final Economy base;
public ProxiedEconomy(Economy base) {
this.base = base;
}
@Override
public EconomyResponse withdrawBalance(OfflinePlayer player, double balance) {
// log something
return base.withdrawBalance(player, balance);
}
...
}
Its a bavarian saying meaning "the barrels have been tapped". Oktoberfest started. I live near Munich.
fun that's even further
p sure that alex is near nuremberg
I wonder if I can catch a flight between dusseldorf and munich
36€ train interesting
I might financially die with the price of everything given y'all earn like 4x more
Yeah a lot of things are unnecessarily expensive currently
thing is half the spigot market is in germany
and I'd like to meet y'all
better than meeting one of the only other portuguese devs, magma
who keeps threatening to yeet me off a cliff to this day
If we do a spigot creator meeting somewhere in germany then ill be there.
Unless its too far up.
think alex is in nuremberg
munster
which is up..
near dusseldorf actually
not sure if I'd feel safe near alex
to get average earn in CIS segment u need to divide 4x
He wont be able to do anything with all the anxiety relievers in his blood.
Will probably just noodle around
bro will jab me with sumn
how much earn average spigot developer?
here is my code:
when a player kills a player, it should set the "first" to false and "second" to false, but after when they do /start it says "game is full"
yikes germany is like an 8 hour drive
for hour
0
pain and suffering
That was about what i made in my last contract as well
where did you get the orders from?
ppl come to me
I want one too
you remind me of that 14yo kid last week
saying he was gonna learn java to make plugins like me
does anyone have a solution?
wow, I want money too . 🥲
)))
You are probably creating two instances of this class, right?
thing is I took like 7 years to get to this stage
where I'm comfortable living with the money I earn
i'm asking that
only working part-time
no i have it all in the System.java class
nice job though illusion, i admire that 👍
im based in asia, russian segment
I had no other choice
Show where you register the command and listener
but still
earning less 5$ 🥸
yeah average wage here is like 4$/hr
here:
package me.gizmo0o.bowduel;
import org.bukkit.plugin.java.JavaPlugin;
public final class BowDuel extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
this.getCommand("start").setExecutor(new System());
this.getCommand("leave").setExecutor(new System());
getServer().getPluginManager().registerEvents(new System(), this);
getLogger().info("BowDuel Enabled.");
}
@Override
public void onDisable() {
// Plugin shutdown logic
getLogger().info("BowDuel Disabled.");
}
}
mom's unemployed and dad's earning minimum wage 
Here is your problem
me too
and youngling illusion is buying christmas and birthday gifts for his international friends while we speak
oof, im glad it worked out for you
present me elon musk's ethernet 😃
You are creating 3 separate instances of your System class.
Each instance has its own fields which are completely independent from each other.
ethernet speed in kazakhstan so bad, average 0.5 kb - 1 mb
tbf this is more of a design flaw than an oop flaw
but oop clicked on my head when someone told me this 🙏
oh so how should i write it?
government say we have better ethernet speed than tokia, japan xdddd
Use only one instance. But you should 100% create 3 or 4 new classes for this and split your commands and listener.
you should also cache your items n stuff
by using one instance do you mean like this? (sorry im new to java)
yes. But try to understand why. It will be the most powerful tool you have when programming in java.
ok thanks i think i understand it now
im new to java but i made this plugin, it works amost completely fine but its really laggy, any tips on optimizing it? (here it is if you want to take a look https://paste.md-5.net/ewugimamil.cs)
oh dear
Yeah not touching that either
Yes, let me just skim through real quick.
good luck with that
Oh yeah. You can start by installing spark on your server and send us the timings.
Make sure to trigger those events.
Ok so here is the first optimization:
Instead of iterating over all matrix slots several times, you can just iterate over them once and check each slot agains your custom items.
on player move id also check if the player has actually moved
since mouse move spams it as well
nvm, forget what i suggested. Completely other approach: How about you use actual recipes instead of the PrepareItemCraftEvent?
I tried, but couldnt make it work
i couldnt make custom recipes with nether stars, depending on the namespaced key so i just did that
You need to use ExactChoice ingredients if your want the ingredients to match perfectly, including name, lore, pdc
ill look into that, it will make things a lot easier
an ItemBuilder would also... considerably cleanup your code
@EventHandler
public void onEntityTarget(EntityTargetEvent event) {
Player player = (Player) event.getTarget();
This will throw a ClassCastException if a zombie targets a villager for example
Always do an instanceof check before casting.
btw how does spark profiler work...? i get that i add it to the server but what else
nah im pretty sure one always runs by default nowadays
/spark profiler open
try that
You are creating a memory leak with those runnables
new BukkitRunnable() {
@Override
public void run() {
for (Entity e : entities) {
Location loc = player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(3));
loc.setYaw(player.getLocation().getYaw());
loc.setPitch(player.getLocation().getPitch());
e.teleport(loc);
}
}
}.runTaskTimer(this, 0L, 1L);
You start many runnables but never stop them anywhere.
my intellij falling to it's doom after i had the Material class openned for 10 minutes
it says "An error occurred whilst opening the live profiler"
huh
try /spark profiler stop then
Hello, I'm trying to create a Spigot plugin with dependencies on Pixelmon. Is there a way to capture events from the Pixelmon mod? Using:
Pixelmon.EVENT_BUS.register(new ListenerPixelmon());
causes a server crash when the event is triggered:
[ERROR] Exception caught during firing event: ListenerPixelmon
How do you even run spigot with mods?
Is there a new cauldron?
im using mohist
Ah yeah, they exist. Show the whole exception
it closed but still says the same, ill restart the server and try again
sure
[17.09 17:27:03] [Server] java.lang.NoClassDefFoundErrorcom/ez/pixelmonez/listeners/ListenerPixelmon
[17.09 17:27:03] [Server] at com.ez.pixelmonez.listeners.ListenerPixelmon_onPokeBallThrowEvent_ThrowPokeballEvent.invoke(.dynamic)
[17.09 17:27:03] [Server] at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
[17.09 17:27:03] [Server] at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:318)
[17.09 17:27:03] [Server] at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:298)
[17.09 17:27:03] [Server] at TRANSFORMER/pixelmon@9.2.2/com.pixelmonmod.pixelmon.items.PokeBallItem.m_7203(PokeBallItem.java:75)
[17.09 17:27:03] [Server] at TRANSFORMER/minecraft@1.20.1/net.minecraft.world.item.ItemStack.m_41682(ItemStack.java:328)
[17.09 17:27:03] [Server] at TRANSFORMER/minecraft@1.20.1/net.minecraft.server.level.ServerPlayerGameMode.m_6261_(ServerPlayerGameMode.java:376)
Ok we are getting very deep into classloader fkery here it seems.
Im not sure how mohist handles class loading. And understanding this
is crucial to solving your plugin-mod communication problem. You should probably
ask on their discord for help.
NoClassDefFoundErrorcom implies that the class could not be found on runtime.
Maybe try registering your listener a few seconds later.
does inventory.remove(eventItem); removes all types of this item in inventory? i have 2 special boxes in eq and both get removed
no
What would be the best way to handle custom items, basically i have a class called CustomItem and i have various classes that extend that, but if i restart how do i make sure all the data of the item class is stored on that item and read back again once the server restarts?
And only if the item has the exact same stack size and meta
Here is an advanced solution
https://www.spigotmc.org/threads/how-to-handle-custom-items.593039/
Write the data in the ItemStacks PDC
yeah this looks good i'll try this
smile endorsing his 7 month old tutorial
you should rewrite it
Does anyone knows about base components?
yes
Sooo
just ask
One moment
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
someone know how regeneration work in the shaft
X1 is with sign X2 without sign
So could you help me with it?
what exactly is the issue?
I have 4 text components
2 with hover and click events
1 with hover and click event and 3 with hover and click event
it goes:
1
2
3
4
but 2 text component receive hovers and click event from 1 and 4 receives hover and click event from 3
okay basically
and i need 2 and 4 text component be without hover and click events
components are sort of represented as a hierarchy
🤔 mhm
so basically if you have the text "Hello Jeff Goofy"
you could represent this as three components where the first one is "Hello ", second one is "Jeff" and third one is " Goofy", additionally it may be the case that structurally they are defined this way:
"Hello "
"Jeff"
" Goofy"
that means, if you add a click event or hover event to "Jeff" then " Goofy" will also receive/have that
well one way is to just unset hover and click events for the component " Goofy"
and how to do it?
?jd-bcc
alr let me show u code wise
actually idk if its possible with bungeecord chat, well I will show u another way of dealing with it
oh thanks, cause i couldn't find the way to unset events
"Hello "
"Jeff"
" Goofy"
^ that will give you the code below, note " Goofy" is a child of "Jeff"
BaseComponent[] component = new ComponentBuilder("Hello ")
.append(new ComponentBuilder("Jeff")
.event(new ClickEvent(...))
.append(new ComponentBuilder(" Goofy")
.create())
.create())
.create();
.
"Hello "
"Jeff"
" Goofy"
^ that will give you the code below, note " Goofy" is NOT a child of "Jeff"
BaseComponent[] component = new ComponentBuilder("Hello ")
.append(new ComponentBuilder("Jeff")
.event(new ClickEvent(...))
.create())
.append(new ComponentBuilder(" Goofy")
.create())
.create();
yeah, its like a tree
can be quite confusing, which is why many prefer minimessage for instance (altho thats adventure)
Ohh yeah, i got it, thanks
and its at this moment conclube demenstrates the contradiction scenarios
or maybe not lol
elaborate :>
idk was hoping you had something in mind, there is always some contradiction somewhere
myea true lol
So... it still doesn't work
String page = bookMeta.getPage(i);
TextComponent withSign = new TextComponent("§7[§2✎§7]");
TextComponent withoutSign = new TextComponent("§7[§4⏹§7]");
BaseComponent[] space = new ComponentBuilder(" ").create();
BaseComponent[] pageComp = new ComponentBuilder(page).create();
BaseComponent[] hoverWithSign = new ComponentBuilder("X1").create();
BaseComponent[] hoverWithoutSign = new ComponentBuilder("X2").create();
withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign " + i));
withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign " + i));
ComponentBuilder result = new ComponentBuilder();
result.append(withSign);
result.append(space);
result.append(withoutSign);
result.append("\n");
result.append(pageComp);
newBookmeta.spigot().addPage(result.create());
smh, using legacy bad color codes inside components
Even this don't work
String page = bookMeta.getPage(i);
ComponentBuilder withSign = new ComponentBuilder(new TextComponent("§7[§2✎§7]"));
ComponentBuilder withoutSign = new ComponentBuilder(("§7[§4⏹§7]"));
BaseComponent[] space = new ComponentBuilder(" ").create();
BaseComponent[] pageComp = new ComponentBuilder(page).create();
BaseComponent[] hoverWithSign = new ComponentBuilder("X3").create();
BaseComponent[] hoverWithoutSign = new ComponentBuilder("X4").create();
withSign.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
withSign.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign " + i));
withoutSign.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
withoutSign.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign " + i));
ComponentBuilder result = new ComponentBuilder();
result.append(withSign.create());
result.append(space);
result.append(withoutSign.create());
result.append("\n");
result.append(pageComp);
newBookmeta.spigot().addPage(result.create());
is there a way to simulate server delay in a simple way? Like 50-100 ms?
you would need to intercept the packets but still allow the ping packet through and time it
bleh
and then once the packets in queue reach that time release them
lol
bungeechat is dum. you need to specify that you don't want format retention. by default append seems to inherit formatting from the previously appended component
yeah but how??
which is crazy. the default is to not take advantage of the tree structure
there is an append method that takes a FormatRetention enum as the 2nd param
oh i will try
sorry i'm a bit stupid, and don't know anything about format retention.. Do you have any tutor?
Am I tripping or does this not handle multiple players well https://paste.md-5.net/esekolopok.java
that enum just determines what is copied from the previously appended component to the component being appended now
4 options, all, none, formatting, events, you probably want none
yeah but idk syntax or how to do that
its an enum, that you pass as a parameter. there's nothing crazy here. you add another parameter to append with the enum constant you want to use
is there a way to partially copy an array in a simpler way than making an array of the desired length and copying the relevant entries in a for loop?
you're narrowing your scope by using the main scoreboard
plus this one gets serialized
I still can't imagine what does it look like.. What constant should i add there? Sorry i'm a bit stupidd
Should I use a new one per player?
make an array of the desired length and then use System.arrcopy
if you have per player sidebar yes
builder.append(component, FormatRetention.NONE);
!learnjava
?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.
Oh shit sorry, yeah i have already found out it
i'm just have problems with understanding anything at the evening
how can i get custom head
thank you very much
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
headMeta.setOwnerProfile(PlayerProfile);
head.setItemMeta(headMeta)
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UUID myskin = UUID.fromString("0957d56b-7221-481e-8e89-60f941bde1b6");
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta meta = (SkullMeta) head.getItemMeta();
meta.setOwningPlayer(Bukkit.getOfflinePlayer(myskin));
head.setItemMeta(meta);
player.getInventory().setHelmet(head);
}```i tried something like this but it gives me alex's head
Do you have licensed minecraft?
umm its not..
i mean.. You have account of minecraft?
Like..
Oh nevermind
try this
UUID myskin = UUID.fromString("0957d56b-7221-481e-8e89-60f941bde1b6");
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta meta = (SkullMeta) head.getItemMeta();
meta.setOwnerProfile(Bukkit.getOfflinePlayer(myskin).getPlayerProfile());
head.setItemMeta(meta);
@eternal oxide ALRIGHT WHAT THE FUCK
Caching the damn handler does indeed not trigger the exception?!?!?!?!
I'd like an explanation
i tracked it down to this though
at io.github.moterius.GreekGodsPlugin.Event.Handlers.EventPlayerJoin.onJoin(EventPlayerJoin.java:14) ~[?:?]
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.profile.CraftPlayerProfile.validateSkullProfile(CraftPlayerProfile.java:38) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3862-Spigot-d2eba2c-db4ba28]
at org.bukkit.craftbukkit.v1_20_R1.inventory.CraftMetaSkull.setOwnerProfile(CraftMetaSkull.java:244) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3862-Spigot-d2eba2c-db4ba28]
at tr.enes.aetheriarankup.events.InventoryListeners.onJoin(InventoryListeners.java:63) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]```
hm this is irritating
when this glitch happens, multiple classes are not loaded and throw ClassNotFoundException
can someone please explain how this can possibly happen
- inconsistently
- at all
- on server start
wth with Bukkit.getScheduler().isCurrentlyRunning() - always return false
when i start task anyways return false
You probably have a static initializer block in your class. When you have an actual object return correctly all is fine but when you return null, it will cast fine but yoru class will fail to initialize due to the static block
static initializer?
static {}
it will be due to one of your static fields then
Your actual issue is getting null from the map
best explanation I could find.
you can cast null to anything
but when you try to actually instance it it will fail with a NoClassDef error
if you have a static init/field which fails
this is the first class that shows up in java.lang.ClassNotFoundException, when i try to call the last method
neither this class nor the class calling that method contain ANY static keyword except that string at the top
If I remember the error was with yoru PatronHandler
how to get enchant by key
that too
it returns null and when it tries to cast that null it throws the error
but there's nothing returning null here
well yea but it's not throwing an error there, its saying it cant find the class i posted
public class EventPlayerJoin implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
//ClassNotFoundException: PlayerDataHandler
PlayerDataHandler.setupHandlerHooks(player);
Echo.getInstance().getPlayerHandler(player).setup();
}
}
yes. It won;t throw an error there but it will pass null around
thats an issue for later me, I'd rather figure out why the class aint found first
ill handle the NPE later
also that patron handler line cant return null
its not the same i posted earlier
this is a call that returns at worst the empty interface implementation
show you full PatronHandler
?paste
abstract?
wym
im not messing with default methods but this class aint supposed to be instantiated either
so what class extends this?
lots
all of em named in that method at the bottom
is it relevant?
cuz its this class its saying it cant find
yes, whichever class you are creating which extends this is where your error is
well since i since then have restarted, i cannot test that easily right now
actually that may be all it is
wym
if your map returns null and you are casting that to an abstract class (PatronHandler).
it can;t be instanced so errors
its erring before that part tho
its erroring when your map returns null
thats what you showed yesterday
yea but it also happens earlier
in onjoin
where it calls a static method
Player player = event.getPlayer();
PlayerDataHandler.setupHandlerHooks(player);//line 14
EventPlayerJoin.java:14
yea, its saying it cant find that class
and that class is just public final
i posted it earlier i think
ok thats odd
the REAL problem is that it aint reproducable
i cannot consistently encounter this error
like its so fragile reload/restart makes it go away
if I were you I'd create your data instance in PlayerLoginEvent
then do the setup in join
data instance?
your PatronHandler
ah
idk then
sorry
not a clue then
i mean the damn thing clearly exists
I don;t see any reason for your util class to throw a no def found error
conclube or 7smile7
well smile aint here so @ivory sleet it is
?nms
you mean me?
yes
i dont, this is after restarts
I covered that yesterday, possibility of another plugin using the same classes
theres literally nothing there
im developing in a vacuum
the plugin folder contains one file
Post your entire server log
Are you catching Throwable and hiding a different exception somewhere
yesnt
I have a custom log handler registered
but i am not stopping anything from getting written to console
nor am i doing try/catch more than necessary
?paste
here log until i did /reload to focus on another issue
after which this didnt happen anymore
i do have no clue how restarting or reloading makes this go away, it really shouldnt
the first class is responsible for assigning a handler to every player
since its not found and the joinevent crashes, its not present and returns null later on
but that should produce NPEs and not more ClassNotFoundExceptions
also i just checked, only try/catch are in a class for serialization and in a command
so it aint getting caught and thrown differently either
No idea, what's your logger doing
Also any exception in a static field or constructor will cause a classnotfound
But there should be more log info on that case so idk really weird
my log handler is removing most of the message and sending the rest in chat so i can guess easier what the issue is, it's not really doing anything here
also, the first classnotfound has nothing to do with static fields or constructors
why are you showing a screenshot of a "1.0-SNAPSHOT" version while you're using "1.0.0" on the server?
uh
are you not using maven properties / filtering in plugin.yml?
wym
how to change result of craft using CraftItemEvent?
show a screenshot of your plugin.yml
Remove the log handler and send us the real error
cant
It sounds like it's hiding the issue
getInventory() and use setResult()
its not reproducable
oh ok thanks
wdym
Well remove the log handler and then we'll have a real error when it comes
when does it happen and when does it not happen lol
Don't mess with logs
filtering log messages is ONLY acceptible to get rid of passwords or anything
i cannot tell thats the problem
I'm not doing anything to the passed LogRecord except reading it out
@Override
public void publish(LogRecord record) {
if(record.getThrown() != null){
Throwable thrown = record.getThrown();
StringWriter out = new StringWriter();
PrintWriter out2 = new PrintWriter(out);
thrown.printStackTrace(out2);
String fullTrace = out.getBuffer().toString();
String causedTrace = getCausedBy(fullTrace);//fullTrace.replaceFirst("((.|\\n)*?)(?=(Caused))","");
String clean1 = causedTrace.replaceAll("\t","");
String[] clean2 = clean1.split("[\n\r]");
adminPublish(clean2);
}
Is there any event on changing writable book?
im not changing anything about log4j afaik
this is the only part im interacting with the logs apart from Plugin#getLogger().log
Playerbookeditevent
Thanks
can we get my PR merged pls
makes no sense that getSlot() is deprecated
-1 is perfectly fine for offhand 😛
What does PlayerInventory.getItem(-1) return
Or InventoryClickEvent.getClickedSlot for offhand
me in my death bed, seeing single letters on my heart monitor, remembering the time when i used nms unmapped
40 I guess
but I mean the javadocs specifically mention it returns the HOTBAR slot, or -1
it doesnt not say it returns anything that's on-par with the normal inv numbers
alternatively it could have a boolean isOffhand() too, and we keep the -1 to indicate "it's not a normal hotbar slot"?
Idk what else slot would mean if not those numbers
if you have a chest open, then the hotbar won't be 0-8 too
in an inventory view, the hotbar will be 36-45 or sth
so that's inconsistent anyway
alright for now ill change the number in the pom to the proper 1.0.0-Snapshot and see if thatll help
idk I'm not complaining, I just think it must be possible to get the "slot number" without using a deprecated method
that will not change anything
send the .jar file you're using on your server here
any dependencies?
What's the use case?
it doesnt do any calls or have any names equal to classes in the other plugin
for example using a book for "private messages", then delete the item from the inv once it was edited
right now you can only get the bookmeta, not the itemstack
btw I don't think yo ucan get offhand item at all using getItem(...)
IIRC you can only get it using getItem(EquipmentSlot) or using getExtraContents()
but I am not sure
That doesn't sound correct but idk
as said, I#m not sure. But I don't think anyone expects being able to just throw the result of getSlot() into the inventory as the docs clearly say it can be -1 for offhand
The docs specifying the bad behaviour doesn't make it not bad
yea thats the other issue i mentioned
the NPE i was realoading of
this aint the classnotfound
like i said
i do NOT know what causes it
its not consistent
which alternative would you suggest? imho it MUST be possible to get the slot. what a bout a simple boolean "isOffhand()"?
it happens in like one in ten restarts or so
while keeping the -1 thing?
I really don't think that returning -1 is "wrong" in any sense
we could alternatively rename the method to getHotbarSlot(), that way people know it's not meant to be thrown into Inventory#getItem(...)
Well I'd want to know for sure what the offhand slot is and then suggest that a new method should return that
Sounds like itemstack should also be added to the event
what the offhand slot is depends on context
in PlayerInventory it has another number than in CraftingInventory iirc
CraftingInventory doesn't have an offhand or hotbar
hello, I don't understand my error, it tells me this: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener except I did everything correctly I added the dependency and the repository in my pom.xml
even if I add it in the dependencies I must add it in the plugin on the server too?
you're not using the maven shade plugin
https://blog.jeff-media.com/common-maven-questions/ second headline
People just getting started with maven always ask me the same 3 questions, so here’s a a short FAQ! How to change the output directory? Read this. How to shade dependencies and what it means Sometimes you are using certain libraries (for example, my CustomBlockData class, or similar stuff) that is not already present at...
oh it's protocollib? yeah that's usually something you don't shade
yes it's protocollib
so did you add it as depend or softdepend in plugin.yml?
yes
oh my god it’s so preppy in here
no clue what that means
is that some kind of nova scotia idiom I'm too european to understand
you don't have ProtocolLib installed
if you want to use protocollib in your plugin, ofc it must be installed
I can't just include it with the pom.xml?
No. ProtocolLib is a standalone plugin that needs to be installed
what are you trying to do btw? listen to incoming packets?
or listening to outgoing ones?
or just wanna send packets yourself?
Basically I wanted to provide better personalization of the chat and also check that users do not receive messages from other plugins or scripts, for example checking that the player does not receive the seed from the server
ok so you want to listen to outgoing packets
in that case, using ProtocolLib is fine. But as said, you'll have to install PLib on the server too
an alternative you could use is PacketEvents by retrooper, you can shade that and then people do not have to install anything else
(although 95% of servers got ProtocolLib installed anyway, so I wouldnt worry over having that as dependency)
the server for which I am making the plugin already has protocollib installed so I take the opportunity to use it
then you just gotta install it on your test-server too
and since your plugin NEEDS protocollib, use depend instead of softdepend in your plugin.yml
thanks
How do I get the player's UUID? Because through skullmeta there is a problem, that if I set the head with p.getplayer() then the head is shown with the player's skin, but it opens the gui to the last one to enter the server, preventing others from opening the gui. PS: It's a head that opens your profile gui to the Hub
Player#getUniqueId
Hi guys, we are currently busy with the development of a minigame, have been here for days on a solution for a Spectator mode, which does not involve any problems, but we can not find a solution. In the normal spectator mode all players have armor stands over their heads as spectators, we somehow can't get these removed either, in versions we tried without the spectator mode of Minecraft (gamemode 3) you can't see the other players in the tablist etc.
Does anyone here possibly have a solution so that we can finally complete this project
Thank you very much 🙂
Yes, already tried but it marks an error in red
then your player is not a player
"marks in red" is also the worst possible decription
tell us the actual error message
omg wait i feel so smart i’m the one helping..
probably you're getting the "player" from an InventoryView and hence it's "only" a HumanEntity
Ok, wait while I tell you the error message
ok go ahead
i think theyre making some sorr of gui
bye 😭
you and me @thin iris can still battle later in #bot-commands
LMFAO
He won't let me send photos, on red intellij
does it have harry potter trivia
read the error message
and put it here
Ok wait
or dm me a photo and ill relay it here
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
oh wow
yeah it's nice but we superior mac users don't need any tools for screenshots
or just use sharex and route it through imgur
i like the way i can make boxes witb red lines
macOS builtin screenshot tool beats lightshot 😛
Java: incompatible types: java.util.UUID cannot be converted to org.bukkit.profile.PlayerProfile
yeah
whats the best way to check if any player is within range of a specific entity? I feel like looping through them all would get laggy..
show us the code
yes, a UUID is not a PlayerProfile
what are you trying to do?
getNearestEntities i think
or
entity.getNearbyEntities or something
it's fine to loop through them all
p sure that chunk#getEntities just does the same stuff
no, it would not cause ANY lag
really??
period
checking distance is just some extremely cheap math
a normal CPU has at least 2GHz
imagine how many simple calculations it can do
it’s not like you’re spawning particles at all those locations
the answer is: MANY
haha
premature optimization is a bad thing
don't forget
your first goal is to make your things work
Skullmeta, test with the skin of the player that opens a gui, if I put p.getplayer it works, but then in the server it starts the gui only for one player, i.e. the last one who enters, if I exit and return in fact it works for me and the others no
we minecraft people usually try to stay within 50ms for our operations
so you wanna create custom heads or sth?
that's in a single core
x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis
Does this mean I just give it 10 if I want it to be within 20 blocks?
I can loop over all existing entities 1000 of times per tick and it wouldnt affect the mspt in any noticable amount
correct
you need millions
now think about
if you did this in like 128 cores
and instead of 50ms it was 1 second
haters will say it's not like that 
that's how many operations a server cpu can run per second :)
if someone ever mocks you for using distance() instead of distanceSquared(), tell them to upgrade their 1998 CPU
Yes, in the sense that each player displays the head of his skin, and with p#getplayer it works, but it doesn't open the gui afterwards, if I remove skullmeta it works instead
no bro 
alex btw I pinged you the other day
I remember you toyed around with real estate
got any houses in dusseldorf I can stay at for 3 days 
why are all the pink guys here german
sorry but
?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.
no sorry I only own property in münster
I mean it's close enough
will i get an answer for my question, because there were so much messages, i dont think that anyone will read it anymore 😄
well you can stay at my place if you wanna sleep on the sofa lol
any others
hi
everything else is rented out
how can I correctly escape the Regex "^(\w+).*?(\d+)$" as a string?
so I can properly compile it
is that the exact regex?
escape the regex characters
yes
String myRegexString = "^(\\w+).*?(\\d+)$";
Hi guys, we are currently busy with the development of a minigame, have been here for days on a solution for a Spectator mode, which does not involve any problems, but we can not find a solution. In the normal spectator mode all players have armor stands over their heads as spectators, we somehow can't get these removed either, in versions we tried without the spectator mode of Minecraft (gamemode 3) you can't see the other players in the tablist etc.
Does anyone here possibly have a solution so that we can finally complete this project
Thank you very much 🙂
I already tried that
didn't work /:
it is correct
isnt there a method to hide players from one another
it's not matching the string that regex101.com tells me is right
oh i know that feeling
uhh
player.setInvisible
or something
no, I was right
what are you trying to match? If you want the dot to match newlines, then you need to set that flag
DOTALL
regex101 defaults to using gm as flags
did you ever call find() on your matcher?
Nop
matches mean match on whole string right
im calling #compile() and then im calling #matcher(string).group(2)
you have to find() first
after matcher before group?
String myString = "my name is mfnalex";
Pattern namePattern = Pattern.compile("my name is (?<name>.+)");
Matcher matcher = namePattern.matcher(myString);
matcher.find();
String name = matcher.group("name"); // name will be "mfnalex"
very ugly
do better
but why u have $ at the end
alright imma try that real quick
yes, you have to remember that a matcher can have more than matches. a matcher is a bit like a mysql resultset or an iterator. you first have to tell it to "move to the first match" using find() once
because the data is before a dollar sign
$ usually means regex end
$ means end of line
try escaping it
sure
why do you have the one-line method enabled?
so calling find() did work?
btw just a tip, you should always used named groups
it makes things easier if you ever change your regex
bro came here to judge
oh ok
@tender shard i fell asleep lmfao
It's mostly personal preference
I can click on it and it'll show me the full method
I don't care.
3 mins left and I can tell if it is working lmao
I'm not judging, just asking 🥱
happens to me too at least thrice per day
u need help lol
here's a reason why named groups make sense. imagine now you want to add an additional property between key and value, now value would be group 3 instead of 2
so if I change something, it's smarter because the group index would move
basically
(and more readable)
using the named groups you could easily turn this into a map that looks like this
"name" -> "mfnalex"
age -> 28
place of birth -> münster
all you'd have to do is to loop over the matcher while find() is true
cmon CPU, process faster
ill just leave the regex to you
I'm like a half-god in regex. I can get you any regex for whatever you want, but I'm 100% sure there'd always be sometime who could create the same regex much easier
so yeah I can definitely do perfect regex but mine tend to be more complicated than needed lol
if I ever need a regex, imma tell you lmao
i dont understand why the internet says the regex works but it doesnt when i plug it into code
alex is a half-god at everything
because you're doing sth wrong
show your code, show the input
Matcher matcher = PATTERN.matcher(between);
matcher.find();
between = matcher.group(2);
what's PATTERN
Adrian997 hat dir 50$ gegeben! input
private static final Pattern PATTERN = Pattern.compile("^(\\w+).*?(\\d+)$");
ok gimme a minute to start IJ
already told you to escape the dolla
I tried that earlier, but you're probably right, this could be error two
what do you want to extract?
I tried that, but without #find() lol
name and amount of $?
^(\\w+).*?(\\d+)\\$ like that?
wtf
yeah
try it
When I first learned about name groups, they were a game changer
They're newer afaik but Java's RegEx engine supports them so it's neat
@orchid gazelle
public class Test {
private static final Pattern PATTERN = Pattern.compile("^(?<name>.+) hat dir (?<amount>\\d+)\\$ gegeben$");
record Transaction(String initiator, String amount) { }
private static final Transaction getTransaction(String input) {
Matcher matcher = PATTERN.matcher(input);
if(!matcher.matches()) {
return null;
}
return new Transaction(matcher.group(1), matcher.group(2));
}
public static void main(String[] args) {
String input = ("mfnalex hat dir 499$ gegeben");
Transaction transaction = getTransaction(input);
System.out.println(transaction);
}
fuck kinda process ur doing that processing 10k entries is taking you 5 minutes
processing a few million lines of text
wait is that files
yes
ah
idk why you even came up with that regex, that will match almost anything that ends with a $ symbol
imma run that one with the $ sign rn just out of curiousity, but thanks already^^ imma do that
idk someone sent me the regex for the thing I was trying to parse lol
also why did you put a question mark behind the .* ? * already means "zero to unlimited"
only reason to use a ? there is if you want it to be non-greedy
but you don't want that in that your case I guess
please give me a few examples of lines you wanna match and lines you don't wanna match
then I will craft you a perfectly working regex
wait, this does not have #find?
it has .matches
He just match whole the string
not needed as matches() already checks for it
you need to understand how matchers work
they are a bit like sql resultsets
We tried player.setInvisible already, and player.allowFly together with that, but the player cant fly then, do u know a solution for that ?
okay, so. I wanna match anything that includes a player-name(ignore that one I guess), " hat dir ", an amount and "gegeben! "
if you only need one result, and you do matches()..., you don't need find()
hello have u got any listeners to make cactus not raking items
I know how resultsets work, didn't know about matchers tho
so yeah you can compare that
seems like
including decimals?
name can include decimals, yes
Pattern myPattern = Pattern.compile("(?<name>[a-zA-Z0-9]+) hat dir (?<amount>[0-9]+)\\$ gegeben!");
add ^ at the beginning and $ at the end if you only wanna match the "full line"
it's actually insane that you can do this lol
then you can do group("name") and group("amount")
regexes just look like nonsense to me lol
well it seems like it's working, it's at least not erroring anymore lol
thanks for the help already man
np
my above regex could have been simplified e.g. by using \d but imho it's easier to read if you actually do [0-9]
has anyone ever worked wiht the wagon-ftp plugin? If so, is it possible to use sftp with it? when I try I get this error ```[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project Tazpvp: Failed to deploy artifacts/metadata: Cannot access sftp://panel.ntdi.world:2022/plugins/ with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access sftp://panel.ntdi.world:2022/plugins/ using the registered transporter factories: WagonTransporterFactory: Unsupported transport protocol sftp: java.util.NoSuchElementException
[ERROR] role: org.apache.maven.wagon.Wagon
[ERROR] roleHint: sftp
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
are regexes hard to learn?
update maven-deploy plugin to 3.1.1
like I can see it's not thaaat hard to understand, but writing?!
yes 💀
not really, but you gotta be patient and just try things out. regex101 is great
I haven't found a good book about it yet
uhhh I think I messed something up lol
I tend to do my regexes one by one
At Regular-Expressions.info you will find a wide range of in-depth information about a powerful search pattern language called regular expressions.
e.g. if I wanna match "Du hast 123$ von xyz bekommen" first of all I write a regex that finds ^Du hast
then I add the [0-9]+ part
put it into a named group
etc etc
so it's step-by-step
yes, I mean for easy stuff like you mentioned, yeah I can write them by heart now
im already on 3.5.3,
How do servers do this!!???
maven-deploy-plugin != wageon-ftp plugin
mfw mfw
also why do you even need wagon-ftp?
to upload my artifcat to ftp server?
deploy by itself can handle sftp just fine
where does it say that?
a bot connected to a plugin
that is for FTP
Uk what plug-in?
makes sense
you are using SFTP which is basically SSH
idk, they probably wrote it themselves
mhm mhmm
Ik so many servers with this tho
you don't need any further plugin to use SFTP/SSH
just update maven-deploy to 3.1.1
there are a lot of versions of those type of plugins
and get rid of the wagon extension
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<type>maven-plugin</type>
</dependency>
that should be in <build><plugins> btw
not as normal dependency
yep
I’m talking about the expect word to word same
DiscordSRV EssentialsX-Discord btw #help-server
Sorry and thanks
feel free to ?paste your whole pom @subtle folio
https://paste.md-5.net/udawopiluf.xml
still no luck
what is running at panel.ntdi.world at port 2022?
an sftp server
hmmm
i can connect just fine with filezilla
hi, whats up?
?paste the full output of mvn clean deploy -X
it shouldn't show any credentials btw so dont worry
JavaPlugin cannot be resolved to a type
kk
you have not imported JavaPlugin
are you using maven?
your whole project setup is messed up
is this your first plugin?
oh wait there is no JavaPlugin?
yes
no
do you insist on using eclipse?
i insist on not installing another ide
bro create Java Project?
if you're fine with switching to IntelliJ, I wrote a tutorial about using maven + IntelliJ that's 100% fool proof: https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/ @opaque crystal
maven also works on eclipse pretty well, I'd suggest using maven
if you want to keep using eclipse, I cannot help you
but your setup is messed up anyway, the plugin.yml should not be in the sources folder
You would really do yourself a favor by using IntelliJ and maven
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
that's a petty, IJ is much more advanced, easier to use, and the maven integration in IJ is straightforward
if you insist on using eclipse, ask ElgarL, IIRC he uses eclipse
I do too
there also might be an easy tutorial
but I sadly don't know one out of the brain rn
not unless eclipse still thinks its an eclipse project
so you gotta at least delete the .eclipse folder
you just gotta delete the project and make a new Maven Project
lol
btw I meanwhile even suggest people to use gradle instead of maven
does maven deploy not support sftp?
wait are you drunk?
😂
alex you need shooting
i wish i was
no, but I spent 10275 hours into learning gradle
He even wrote a gradle plugin
for beginners I still recommend to use maven
im literally the oldest young developer on this planet
I use all the typical old dev tools, but im literally 16
what is easier to use?
gradle or maven?
DaFeist runs ant?
Docs are good too
naaah lol
yeah I agree
I don't like gradle at all
I don't really see the advantage of me using it
(I used to use it for mod development, and I had to cry multiple times because of gradle doing shit)
You will only notice benefits once you wanna do sth that maven cannot do
gradle is nice when it works
that gave me a mental breakdown with forge
gradle straight up not working for seemingly no reason all the time
uhmm alex
regex not working /:
Gradle always works, you guys are just always abusing the main build.gradle file for stuff that belongs into separate buildSrcs… right @slender elbow ?
Matcher matcher = PATTERN.matcher(between);
if(!matcher.matches()) {
continue;
}
System.out.println(matcher.group(2));
between = matcher.group(2);
``` no sysouts
so #matches does not return true
why are you still insisting on using numbered groups? how does your PATTERN even look like?
how does your input look like?
too little info
it's the run before switchting to your regex
oh wait
nvm
im dumb
I am using your correct regex but forgot to change the group in the code lol
also coming back to gradle: if your build.gradke(.kts) uses any allprojects or subprojects closure, you're probably doing sth wrong, unless you don't manipulate any specific tasks inside there. and even if not, most of the subprojects or allprojects things belong into settings.gradle instead
e.g. declaring repositories that should be available to all subprojects, that never belongs into your build.gradle but into settings.gradle
true
I have a very bold love-hate relationship with gradle
or stuff like setting java version, no, don't do that in subprojects, do that in a java-conventions.gradle file in buildSrc
me too
it's so powerful but the docs are so shitty that it's obvious that people abuse it
if (!matcher.find()) continue;
it's like, holy shit I love it when things are so nice and it just works
the fact that the mcdev-plugin for IJ creates a bullshit example project doesn't really help
but then I do one slightly wrong thing and I spend the entire afternoon on it
only to change one line and be like "oh, yeah that makes sense"
yeah it's a whole different thing. maven uses xml / a set of instructions, declarations. gradle let's you actually code stuff
ofc it's more error prone
one thing I still miss in gradle is being able to pass var/vals to plugins
yeah right
that is unfortunately not possible at all
that makes maven simpler to use
yeppo
yowza
and maven 4 easily defeats the "lol but gradle compiles in 1 second instead of 4 seconds"
yeah you fucked up my regex
im not using maven cuz its better
im using maven cuz thats the first thing i learnt
so im not learning something else cuz it works
im using maven because I like it
:thonk: ?
actually, I used Gradle first
but I hated gradle and decided to go "learn" maven(yeah im still bad)
neither maven nor gradle is better. they are both great tools. maven is like a hammer. you can easily use it to hammer a nail into the wall.
gradle is like of those swiss army knives. Sure, it also maybe somewhere has something that is supposed to act like a hammer but you need half an hour to find out where it is, and even if you find it, chances are high you're using it wrong
gradle is basically
tradeoff: you will hate your life more / you have more features
gradle is made for highly complicated builds that indeed profit from the features gradle offers. maven is made for things where you just wanna say "ok I have this and that dependency and I want it shaded and pls make javadocs too"
what's your issue again?
a class that has nothing to do with static is getting ClassNotFoundException which commonly is caused by static initialization
sooo
0 leads, and its not a consistent issue
okay moterius do this:
so i cant even try to debug it properly
do you have a stack trace?
public class MyPlugin extends JavaPlugin {
static {
try {
Class.forName("my.class.that.is.weird");
} catch (Throwable t) { t.printStackTrace(); }
}
}
as mentioned above:
nvmind i see what u mean now
in the static init block
unless that class is using some static getter of your main class or sth. in that case, move it into onEnable or onLoad
its not using it, some others that dont cause issues are
brrrr CPU is doing wrmmm wrmm
bros got a transformer
someone here recently asked me to do cinebench on my m2 to laugh at me how their desktop CPU is better than my laptop
theres nothing in the console
I did
I'll keep the code and post the stacktrace if it happens again
:)
so where's your cinebench?
not
I already sent you
where?
sorry I snacked 2mg clonazepam that day, it's causing retro-grade amnesia lol
just gimme a TL;DR
what was the results?
I got like 60% more with my 13700k
it was about 1000 -> 1650 non-overclock
isnt that a desktop CPU that takes like 250 watts?
well in that case, getting 60% more than a laptop that takes way less than 100 watts is not really a big achievement
it is if you only care about performance
power usage for example? because my macbook lasts 20 hours playing minecraft
idk I only care about raw performance if I am able to cool it properly
I am using one of the best 360mm water-coolers so yeah
my laptop power cord is rated for 145W for some reason
yeah obviously a water-cooled 5.4ghz intel is beating an m2 in "raw performance"
isnt m2 a folder on windows
.m2 is the maven folder
yeah I was trying to prove that to you because you said your m2 is gonna outperform every desktop pc or something lol
M2 is apple's newest system-on-a-chip
