#help-development
1 messages ยท Page 619 of 1
lol
I just save a bunch of basic type data xD
I didnt know you can make your own type

well I mean I figured since its written vey generically
but I never wondered how I would actually make it
PersistentDataType<?, ChickenWing> CHICKEN_WING_DATA_TYPE
yeah where chicken wing probably implements some interface
you must have missed the Carlos conversation yesterday then
just search for "carlos" and you'll find hundreds of messages from yesterday
Got lucky to have a internet connection
Thank god there is now public wifi in whatever the word for where people get burried is
graveyard
you can declare custom graveyards ingame with /acgraveyard or manually using graveyards.yml
Lmao alex
it's true
Nice
๐, literally
I would say "I'm dying rn", but I'm already dead
Bruh why
Idk shit about plugins, I only make my own lol
axeguy
Wat
What a coincidence that the random letter gen actually made something that makes sense
no context moment
Yk, I'm that guy who has never played the vanilla version of the game and never adjusted the modifications himself so I end up knowing like 3 modding apis and not knowing the simplest mod ever
it's used to store a ChickenWing in a PersistentDataContainer
as byte array ofc
PersistentDataContainer == KFCBucket confirmed
That's how I made custom packets in forge when using own classes
since CHickenWing implements ConfigurationSerializable, it's just a COnfigurationSeriazableDataType -> DataType.asConfigurationSeriazable(ChickenWing.class)
I can code for Forge(But only experience is with 1.12.2) and Spigot
public static PersistentDataType<Integer, Integer> type(Player player, NamespacedKey key) {
PersistentDataContainer data = player.getPersistentDataContainer();
if (data.has(key, PersistentDataType.STRING)) {
return PersistentDataType.STRING;
}
if (data.has(key, PersistentDataType.INTEGER)) {
return PersistentDataType.INTEGER;
}
// and all other types
return null;
}```
is it possible to make this able to return any type of persistent data type
what the heck
I had experience with forge 1.12.2, 1.16.5; fabric 1.16.5; spigot generally
what ๐
what is that
im trying man
Make a blank ChickenBucket class that extends persistent data cotnainer 4 the funi
why don't you just copy/paste the code I sent you
I used forge 1.12.2 and spigot on 1.8, 1.12, 1.18, 1.19 and 1.20
what code
your method is supposed to return a PersistentDataType<?,?>, instead of Integer,Itneger
otherwise the method is pretty useless
I only coded plugins on 1.8 and 1.12 until 2 years ago
ik thats why im trying to make it return any of them
then declare your method to return a DataType<?,?> instead of a specific one
ok
first time using question marks in code
I have never used it because it literally looks senselessly complicated
its not complicated at all
oh you mean what I sent yesterday? well I jut randomly made that up
he says, with 75 years java experience
public final class PDC {
public static interface Type<P,C> extends PersistentDataType {}
public static <T> void set(Player player, String key, PersistentDataType<?,T> type, T value) {
player.getPersistentDataContainer().set(NamespacedKey.fromString(key, myPlugin), type, value);
}
public static <T> T get(Player player, String key, PersistentDataType<?,T> type) {
return player.getPersistentDataContainer().get(NamespacedKey.fromString(key, myPlugin), type);
}
}
PDC.set(player, "age", PDC.Type.INTEGER, 27);
int age = PDC.get(player, "age", PDC.Type.INTEGER);
Why don't just use container.put(Type.String, "ajjshs");
wdym
It could be that easy
- Type does not exist, it's called PersistentDataType
- it takes in a NamespacedKey, not a string
- where's the value?
I meant that it should be like this
in my example yuo can only use Type because I declared another interface that extends PersistentDataType, as ahacky workaround to do sth like import aliases
because tbh yeah lynx was a bit too verbose with all the PDC names lol
i mean, it already has all types that NBT supports, plus additionally a boolean, and for everything else there's ?morepdc
this is my life now
Should work
How many bytes can I save in a pdc?
As many as you want in theory, i guess
But it isn't async right
So if I load an item that has a pdc, it's in mem and can be read/written async?
Well I wanna know when it makes sense to use caching, when use a db and when use pdc
PDC for items is from ItemMeta right?
That's a clone so you can use your own clone async
Yes
But get/set meta calls can't be safely async
Makes sense
hmm yes I am good with naming my functions dont worry about it ```java
void startPlayerCountTimerIfMinCountReached() {
}```

should have named it carlos
Hey everyone, this might be more of a java question but probably fits this context too. I don't know how to phrase it, but if I create a repeating task like this (in onEnable for example) does the "mainWorld" variable have any risk of getting garbage collected or lost? (the only reason because I'd like to have short code)```java
public void onEnable() {
World mainWorld = Bukkit.getWorld("world");
// repeating task
Bukkit.getScheduler().runTaskTimer(this, () -> {
thisCodeIncludes(mainWorld);
}, delay, period);
}
It's still in use so I don't think so. More people would run into issues with it then
If you wanna be sure, try to call System.gc() in your scheduler (don't run that every tick for this test) and see if you run into problems
there is no Inventory.remove which can remove itemstack regardles of stack amount?
or am I mistaking
removeItem
No, it will also stop the world from getting GCed properly if unloaded
well I wanted it to ignores amount of item stack
but looks like that is not possible
basicly making shop neeed to remove all of custom itemstack
All?
and then subtrackt them and return amount which has left
u can use PhantomReference
how do i store an array in PDC theres no type for it
PhantomRefrence still confuses me
Its like a weak reference but you can detect when it gets cleared?
Youโd need to make your own type for it
man are you serious
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
ok good
well i thought u could use it as it should be used
actually just use weak maybe
i am prob overthinking lol
OfflinePlayer instances not matching for same player
you can look it up on yt
of course its made by that alex guy, dudes an actual genius
?paste
Im making a case opening plugin but for some reason in this example the diamond never lands on the middle slots and it feels like the closer to center the slot is the rarer the chances are for the diamond to land on it. https://paste.md-5.net/eviliqakuh.cs
this code could mean anything and im too lazy to check. do you have a video of it?
No, as the variable is still in use, once it is no longer in use it'll get GC'd
what is that supposed to match? it'll basically anything that contains a 5 and later on a 4
what the fuck
how can i get the custom biome name at a location in 1.20.1?
can i get help here about errors in console?
You wanna use jetbrains runtime on your server as java
Or whatever it's called
It improved hot swapping
Improves
thank you so much i have been struggling at this for 2 hours
np
You may want to consider renaming the project to avoid confusion with the tokio runtime
Maybe they should rename their project
When people hear โTokyo rustโ they think of tokio
If course not saying you have to

Just an outside perspective
What does this mean? I cant find anything on google...
just delete the semicolon, wait a second and add it back
I think that's just an ide bug that'll go away when it refreshes it
Concerning
what ide is that
I am using Fleet
I KNEW IT
its new in preview
I RECOGNIZED THE POPUP
i love fleet tho
first tinme it happening it to me
or add a syntax error and then remove it
ahhh okay
no I used fleet for rust and it happened literally constantly
I wonder if it's better by now
setting maven up for this was a pain in the ass. it wouldnt want to save where my maven install was lol
nope, still broken ๐
lol
I reported this exact bug months ago and they marked it as fixed
Tf is a fleet
I see
i like it a lot. very light weight. easier for my macbook lmao.
helix?
fleet would be very nice if it actually worked properly
dont think ive heard of that one.
ahhh okay. i could never grasp vim. i tried. i see all the good it has. but the keymaps. to hard for me to remember lol.
gives off a even more vscode vibes lol.
lol
I use vsc with the neovim extension
Configuring neovim with lua pisses me off irrationally (and using vimscript is even worse)
i only use vscode for JS and python, sometimes C# lol
yeah that's what I keep hearing about it
helix doesn't actually have plugin support right now
neither does fleet ๐ฆ
but it has lsp support and it comes with everything you need out of the box
I like to use it with zellij
I have one pane for helix, one for a terminal and one for bacon (basically an errors/warnings panel)
yo you got bacon?
and this is perfect, it's exactly what I want and nothing more, nothing less
yeah bacon's sick
you know bacon..?
i know of it. seen it around youtube a few times.
interesting
do you watch rust youtubers or something
like no boilerplate
or let's get rusty
lol
and the prime time
this is painful to watch
he my go to guy
ah there we go
why
Im making a case opening plugin but for some reason in this example the diamond never lands on the middle slots and it feels like the closer to center the slot is the rarer the chances are for the diamond to land on it. https://paste.md-5.net/eviliqakuh.cs
hold on
well they portray hackers wrong lmao
i agree lol. i like the simplistic.
now this is hackercore
i feel like i would never need to use an editor like that and ill just be using it cuz its "better" not bcuz i actually like it
now thats just hard to read lol
my guy that is the dumbest reason to not use it lol
you like the "shit he's too strong, help me out" 2 people at one keyboard
no that's rust
fuck
there are genuine benefits to it
lmfao sometimes 4
and if you don't think it's for you, that's fine
You don't really know until you try it
Yeah for most people. no one really needs to leave vscode. its all about the utilities of other ides is when you switch.
i like to be really relaxed and in this almost asleep state of mind when im coding i feel like this would require too much thinking
like who tf uses an editor for the clout ๐ญ
a lot of people flex using vim for example
some people in the vim community have their opinions lmao
use it just so they can say they use it
yeah of courrse they flex it
but that doesn't mean they're just using it for the clout
a lot of people switch just for that
just to flex
which is true. Neovim is insane.
that's so stupid
but it's not just hype
there's good reasons for it
at least a few of these keybinds are game changers
like alt + o has to be one of my favorites
what does it do
By default you cannot use your mouse unless your terminal supports it
yeah thats nice.
so, often
you'll want to select part of an expression
parenthesise it
and then prefix it with something to make that a function call
that's a common editor operation
this makes that super easy
I hit alt + o until I've selected what I want
then I type ms( which surrounds the selection in parentheses
then I hit i and type the prefix
i just use cmd + shift and arrow keys to highlight what i need.
how long have u been using it
yeah that's another good way
the keybinds for regular editors are no joke either
and you can do a lot with home + end too
that used to be my bread and butter before I switched to helix
only a few months
is it good?
yeah I really like it
it's surprisingly easy to adjust with the tutor too
it does a good job of teaching you the basics
helix --tutor
[00:18:55 WARN]: Unexpected character (e) at position 6861.
[00:18:55 WARN]: at org.json.simple.parser.Yylex.yylex(Yylex.java:610)
[00:18:55 WARN]: at org.json.simple.parser.JSONParser.nextToken(JSONParser.java:269)
[00:18:55 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:118)
[00:18:55 WARN]: at org.json.simple.parser.JSONParser.parse(JSONParser.java:92)
[00:18:55 WARN]: at me.f64.playtime.Main.writePlayer(Main.java:164)
[00:18:55 WARN]: at me.f64.playtime.Main.lambda$savePlayer$3(Main.java:150)
[00:18:55 WARN]: at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
[00:18:55 WARN]: at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
[00:18:55 WARN]: at org.github.paperspigot.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:23)
[00:18:55 WARN]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[00:18:55 WARN]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[00:18:55 WARN]: at java.lang.Thread.run(Thread.java:748)
how i can fix this?
the default configuration is so good that I only have 3 settings changed at all
eh im kinda taking a break off of programming rn
seems like there's a syntax error in your json
try looking at position 6861 in the string
maybe ill try it
position 6861
6861 characters into the string
click on the start and hit the right arrow 6861 times
Yeah start counting
lmao

best pitch I can give for helix and vimlike editors in general
bros actually gonna do it
the real way to fix problems
is that it turns coding into a movement game
no fr i need help
and fr go to position 6861
this is when player leave
is this a plugin you made
dude
this channel is for helping plugin developers, not giving support for plugins
no
ok come to help server ๐
so this is the wrong channel to ask unless you are the developer of the plugin
Open it in notepad++ and find character 68xy lol
sorry
bravo za tebe
whats that mean
There's probably a vim plugin for your favourite editor if you want to get used to the movement if you don't want to leave the comfort of your current editor
Congratulations for you
Tho some are lacking
most IDEs have it.
oh is it russian?
Serbian
What
helix does work differently from vim in a few key ways though
@waxen plinth #help-server if you know
Only issue is some aren't really good at emulating, for e.g. the base vim plugin in VSC has a broken block visual mode
wtvr its read like that in russian
please don't ping me, I don't know what's wrong with that plugin and the error reveals very little
Yeah, ive heard of that too. my buddy uses vscode and vim mappings. complains everytime there is an issue lol. im like the pull request for github haha
im so relaxed and sleepy but i dont actually go to sleep wtf is wrong with me
turn your wifi off
fiested lol
vault is primarlily used with ecnonmy right? same with like an auctionhouse and stuff?
Do you guys have any solution for ghost items in GUI?
https://www.spigotmc.org/threads/ghost-item-in-a-gui.277876/
helped me in the past.
ohhh...
if player click that item it become real
even if its cancelled ?
yes
with creative mode they can get everything anyway
and even with sometask like cancelation grindstone
would you have to an additonal check to stop that?
or no way around it?
player with quick enough hand they are abled to do it
I mean you can look at InventoryCreativeEvent
simple, dont give them creative
I just assume it giving potential bugs
creative mode is broken from a security perspective and mojang has never fixed it
Or store and restore their inventory and prevent them from opening chests/dropping items
client can do pretty much anything it likes in creative
how about this #help-development message
We run survival on 1.20.1 and we've tried both paper and spigot but the servers keep crashing but produce no crash log, what should we do?
This also happens with our lobby servers running paper on 1.8.8, they don't create crashlogs either.
I said this before in help server, this has become such a big issue the owner has switched to unturned. I don't know what we can do anymore, the owner has been constantly researching and nothing has been discovered.
Well anyways still #help-server , but besides that, no one can really know whats going on, there is no context, and no logs, idk how i am supposed to know whats going on. start debugging. remove plugins 1 by 1, or only host 1 server and try it. you got to isolate the error.
if it is a plugin, report it to the dev. if not, then something else wrong lol.
Is there a way I can add NBT data to an item instead of manually setting it when used and storing the data in a Persistent Data Container? I have heard that I can use NMS but do not know how to import it. I have BuildTools in a folder in my Downloads and I have the dependency listed in the pom.xml file. I got the error Missing artifact org.spigotmc:spigot:jar:1.20.1-R0.1-SNAPSHOT when adding the dependency to the xml.
I have build tools in a folder and I ran it
What do I do with it though
Itโs in a different directory too
Hello, which one is faster performance between registering a single event listener and registering a class implementing Listener?
Beyond this, I see BungeeCord doesn't provide single event listener registering.
For 99% of use cases it does not matter at all. Or do you wanna register und unregister dozens of listeners every second?
Oh OK, just asking because sometimes I want to register via single-event-listener model.
Hello !
I've somes troubles with my build.gradle i just added a compileOnly path and it broken an other one ๐คทโโ๏ธ (PacketWrapper) i've follow the docs of this depencies and it make no sence that i've got a error xd
here is my stack and my build.gradle
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
> Could not find com.comphenix.packetwrapper:packetWrapper:1.20-2.2.1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/comphenix/packetwrapper/packetWrapper/1.20-2.2.1/packetWrapper-1.20-2.2.1.pom
- file:/C:/Users/Wast/.m2/repository/com/comphenix/packetwrapper/packetWrapper/1.20-2.2.1/packetWrapper-1.20-2.2.1.pom
- https://arcanearts.jfrog.io/artifactory/archives/com/comphenix/packetwrapper/packetWrapper/1.20-2.2.1/packetWrapper-1.20-2.2.1.pom
- https://repo.ranull.com/maven/external/com/comphenix/packetwrapper/packetWrapper/1.20-2.2.1/packetWrapper-1.20-2.2.1.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
}
group = 'fr.citeevent'
version = '1.0-SNAPSHOT'
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
jar.getArchiveFileName().set("${project.name}.jar")
libsDirName = "${jarOutput}"
shadowJar {
from('src/main/java') {
include "fr/citeevent/artemiscite/database/storage.sql"
}
}
repositories {
mavenCentral()
mavenLocal ()
maven { url "https://arcanearts.jfrog.io/artifactory/archives" }
maven {
url = 'https://jitpack.io'
url = 'https://oss.sonatype.org/content/repositories/snapshots'
url = 'https://oss.sonatype.org/content/repositories/central'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
url = 'https://repo.dmulloy2.net/repository/public/'
url = 'https://repo.lukasa.lt/repository/maven-public/'
url = 'https://repo.ranull.com/maven/external/'
}
}
dependencies {
implementation 'org.jetbrains:annotations:24.0.1'
//BDD
implementation group: 'com.zaxxer', name: 'HikariCP', version: '4.0.3'
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '3.0.8'
//Plib
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
implementation 'com.comphenix.packetwrapper:packetWrapper:1.20-2.2.1'
//NPC
compileOnly group: 'dev.sergiferry', name: 'playernpc', version: '2023.4'
// Spigot
compileOnly 'org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT'
//Holo
compileOnly 'me.filoghost.holographicdisplays:holographicdisplays-api:3.0.0'
// Lombok
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}
sourceSets {
configurations.compileOnly.setCanBeResolved(true)
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
artifacts {
archives shadowJar
}
if someone can help me ๐
What packet do I need to send to ack a block break?
If you just want the block break effect then PacketPlayOutWorldEvent
In the vid it shows the items falling in random directions which is what #dropItemNaturally does but im using #dropItem
ty
Hello, does ExplosionPrime event detects all explosions?
Because minecart with tnt bypass this event, that's why I'm asking here.
no
There is EntityExplodeEvent and BlockExplodeEvent
and some others
who can say how much the plugin costs for the event that spawns in rtp coordintates the territory inside which they earn money every second
ItemStack item = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = item.getItemMeta();
if (item.getType() == Material.AIR) {
sender.sendMessage(ChatColor.RED + "You must be holding an item to put up for sale.");
return true;
}
// Create the auction ticket item
ItemStack ticket = new ItemStack(Material.PAPER);
ItemMeta ticketMeta = ticket.getItemMeta();
// Set the display name and lore of the auction ticket
String displayName = ChatColor.GOLD + player.getName() + " - Auction Ticket";
List<String> lore = new ArrayList<>();
lore.add(ChatColor.GREEN + "Up for purchase - " + item.getItemMeta().getDisplayName());
lore.add(ChatColor.GREEN + "Price - " + ChatColor.GOLD + price);
ticketMeta.setDisplayName(displayName);
ticketMeta.setLore(lore);
ticket.setItemMeta(ticketMeta);
I don't know why and get zero errors, but I am trying to set the lore with the display name of the item the player is holding. It never sets. its just blank.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I'd use pdc for your checks
?pdc
I just need the name tho. im not comparing them.
the item gets replaced with the ticket. I want the name of the former item to be on it. because then later on the item will be in another inventory for the auction
How do I properly change the chat format of players? Using e.setFormat() is working but it says [Not Secure] in console.
So how do i do it? cancel event and broadcast the message?
oh
how can I send the particles and sound to a player when given a block (the particles and sound of them breaking a block)
I'm not exactly sure what sound to play and what particles and where ect more details about them
I have BuildTools open to see how minecraft handles normal block breaks but i cant find it
There are packets for that kind of stuff
you do not need packets to send particles or play sounds
Yes do you know what packet I think i tried the ClientboundBlockDestructionPacket and the ClientboundLevelEventPacket. and I don't believe either worked
I will retest the block destruction packet since I had the percent at 10 instead of 100
Edit: Did not work
@quaint mantle playEffect Effect.STEP or something like that
you don't need packets for that
Why it keeps saying "New flags cannot be registered at this time"
I even scheduled 10s after the enable
Given that that isn't a spigot error message, what are you doing specifically ?
can you share some code
registering a WG flag
according to this, you need to define that onLoad
not onEnable
Could anyone tell me how do I change lore's text formatting? Using ChatColor throws "Operator '+' cannot be applied to 'org.bukkit.ChatColor', 'java.util.List<java.lang.String>'"
private ItemStack getItem(ItemStack item, String name, String ... lore) {
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.DARK_PURPLE + name);
meta.setLore(Arrays.asList(lore));
item.setItemMeta(meta);
return item;
}
You want every line of meta to have same color?
You are currently trying to add chat color and list, which doesn't work
Nope, I want displayName to be dark purple, bold and underlined if possible and lore to be just light purple
So what's the other way to format name and lore separately? Maybe deleting ChatColor.DARK_PURPLE and using text formatting tags when I set the name and the lore..?
I mean, you can either format lore before passing it to method or just call Arrays.stream(lore).map((s) -> ChatColor.X + s).toList()
Or instead of streaming
So this is my formatting, although the text doesn't format according to the tags, it just shows the tags as plain text
inv.setItem(10, getItem((new ItemStack(Material.COMPASS)), "&5&lWarps", "&dAbre el menรบ de warps", "&dUsa los warps para ir a distintos sitios"));
List<String> list = new ArrayList<>();
for(String line : lore) {
list.add(...);
}
...
mhm that's a crunchy way of doing menus
You should probably consider some sort of config-based system
I've tried with that but it didn't work so that's why I used the "crunchy way"
I'd start by making an "item builder"
Something like this
As well as some sort of system to read items from a config (https://paste.md-5.net/vevuvabaki.rb)
You can then just load the items from the config by just getting the section and calling ItemBuilder#fromSection and doing magic with it
Okay thank you
Ideally you'd also make a menu system that can load entire menus from a config
But that takes time and skill ๐
But y'know if you want some inspiration
Menus aren't that complex
pytero on top
i have a quick question
how can i send when a player got tempmute to not only send the message that he has been muted only to him
They just need abstraction
so the message can be send in chat for everybody
broadcast
yeah a bit
I mean just gui and pagination can be done in 1 class
how can i send when a player got tempmute to not only send the message that he has been muted only to him
but the message should be send in chat for everybbody to see
?
Your system turns the layout from config to a 2d array and then loops over it right
I do something similar to crafting recipes
simple thing how you can parse "1mm 2w 1m" example of a placeholder
Something like this?
except you'd need to change the split logic
as I just use this for things like 15 seconds
lol
Nah dude i have PTSD for regex after last time
With a basic \d+(\w+)
wah
I did a 1 hour tutorial and it's enough to do basic regex
anything more complex and chatgpt does it for me
I wouldn't use it where you can avoid it
throwback to when I was "helping out" with a simplistic private static final Pattern REGEX = Pattern.compile("if\\s*(!)?\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*(<|>|=)?\\s*([a-zA-Z0-9_]+)?\\s*then");
bro that's giving me ptsd and i updated it even more and now i added many other things like Arrays etcs
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); == null why??
what you mean why?
I connected the vault api 1.7.1 plugin, but for some reason the plugin does not find it, although it exists
in mavent all correct
?paste
share your pom
It could be that your plugin enabled before the economy was registered
try doing those checks a tick after plugin startup (use the scheduler!)
how fix

?paste
Yea maven not all correct
a
you are missing the provided scope on both worldguard-bukkit and vaultAPI
what is it for
to tell maven that the classes of that dependency will be provided by your runtime
and maven does not have to include them in your output artefact
still not working
you recompiled and updated the jar ye ?
you have a dependency on Vault in your plugin.yml as well ?
something im saving the date when the multipliers will finish but in timeunit and if how can i check them, so if the server stops i can start a Runnable and check them
Is there some persistent data container that can be stored worldwide? Like, there's pdc for chunks, for entities, items, is there pdc for worlds tho?
database
Well, that's not pdc
base64 brrother
config files
Is there someone who got the time and want to help me out with this one?
I am trying to make simple code that prints a messsage to the player if its standing still on the same block for 3 seconds. (is has to be same block and not same coords, I want the player to be able to walk a little bit inside the block)
If created this:
public void onPlayerMove(PlayerMoveEvent e) throws IOException {
Player player = e.getPlayer();
BukkitRunnable moveTask = new BukkitRunnable() {
@Override
public void run() {
player.sendMessage("You've been standing still for 3 seconds. [" + e.getPlayer().getLocation().getBlockX() + " / " + e.getPlayer().getLocation().getBlockY() + "]");
}
}; moveTask.runTaskLater(plugin, 60L);
if(e.getTo().getBlockX() != e.getFrom().getBlockX() || e.getTo().getBlockY() != e.getFrom().getBlockY() || e.getTo().getBlockZ() != e.getFrom().getBlockZ())
{
moveTask.cancel();
}```
but for some reason this task keeps spamming when Im running. Does someone know why, because im not seeing it yet
The goal is that the player recieves once message the moment it standing still for 3 seconds
player move happens a lot
Thats true
but you create a task every time it happens
Yeah and im canceling that task if the player is moving
thats an insane amount of tasks
That is true
you can move without changing blocks though
Yeah like look around
Yeah but there is no event that triggers when changing block location
So i can either use this event or create a bukkit runable
whats the goal of this anyways
Im creating a PropHunt and im using a display block to move around, but if the player is standing still for 3 seconds, i want to remove the display block and place a real block on that location
Already got the display block and setting the block, now only this detection system
and also its better to just not create a task if you know ur gonna cancel it instead of cancelling it instantly
okay then dont use block positions to check if a player has moved
I see, what is a better solution or tactic to handle this problem, got any advice?
if a player didnt move, this even wont fire
Yeah i do want the player to be able to look around
and if it moves a slight pixel but still stands on the same block to not count it has movement
yes
world implements PersistentDataHolder
what's the issue
okay, well first off, this is not an easy thing to do, but anyways, you would need to have a task for every player that you reset when they move
same problem
Agree, it need one task per playe that just resets its time when someone moved
yes
what exactly? i dont see you having sent any stacktrace
so you need to store those tasks outside of just the handler method
Yeah like a seperate class?
like in map
So HashMap the task and to create a map with a plaer and task
yes
well with player id but same thing
and then when the game starts, add every participant and start the tasks
oh is storing player worse the id?
https://paste.md-5.net/ogepurusas.makefile - plugin.yml
yes
what's the issue?
Is that because of data size?
the Player object is not always valid, the uuid will always be valid as it is tied to an account
that too
Ahh
a uuid is way smaller than the whole player
Ill change that because i got some maps that stores players
a player object is invalid if they rejoin
Sounds good
(or if they just leave without rejoining)
but yeah from there it should be easy
in the movement event check if they moved over a block, then reset the movement task
plugin not can find vault plugin for work. more precisely judging by the logs
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); == null
which may be a bit server intensive but you would just have to try it out
maybe a better way entirely is to have 1 timer task and just store timestamps in the map
you don't have any economy plugin installed
You gave me some new idea, ill try that and if im stuck ill comeback
as I said, you don't have any economy plugin installed
Vault
vault is not an economy plugin
wha
what?
vault makes sure you can interact with the economy of other plugins
vault is an API so you can use different economy plugins so you don't have to write a module for every existing economy plugin
instead of writing a hook for EsesntialsX, and iConomy, and WhatEverEconomyPlugin, you just hook into vault
that's what it's for
vault itself doesn't do anything
vault not create dollars for use?
correct
i not can give dollar player?
you not can give dollar player
public void addMoney(Player player, double amount) {
if(amount < 1) return;
if(!api.hasAccount(player)){
Bukkit.getLogger().info(ChatColor.RED +"[LostZone] ะธะณัะพะบ ะฝะต ะธะผะตะตั ะฐะบะบะฐัะฝัะฐ ะฒ vault");
return;
}
api.depositPlayer(player, amount);
}
this work so
why
if you claim that it works, then why do you claim here that it doesn't work
vault is like a conductor chtoli?
i no need use maven for another economy plugin? just dowold
or i shold?
Just put the plugin in there
If you're not interfacing with or shading something there's no point in putting it in maven
no, that's what vault is for
why did you even add vault to your dependencies if you have no clue what it is nor what it does lol
{
"parent": "item/handheld",
"textures": {
"layer0": "items/shield"
},
"overrides": [
{"predicate": {"custom_model_data":50000}, "model": "item/rings/fire_ring"},
{"predicate": {"custom_model_data":50001}, "model": "item/rings/water_ring"},
{"predicate": {"custom_model_data":50002}, "model": "item/rings/air_ring"},
{"predicate": {"custom_model_data":50003}, "model": "item/rings/earth_ring"}
]
}
Any idea why the default shield isn't shjown?
why isnt the plugin finding the command
(paper-plugin.yml)
commands:
puck:
description: "Spawns the puck"
main class
private void registerCommands() {
this.getCommand("puck").setExecutor(new PuckCommand(this));
}
(console error)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "pt.bonnie20402.hockey.Hockey.getCommand(String)" is null
at pt.bonnie20402.hockey.Hockey.registerCommands(Hockey.java:22) ~[Hockey-1.0-SNAPSHOT.jar:?]
paper
?
this is Spigot so use a plugin.yml
I renamed it to plugin.yml
doesn't work either
do I just switch from paper to spigot in pom
yes
build using maven not artifacts. (if Intelij) Right side of screen Maven tab, lifecycles -> package.
yes
as a heads up, paper-plugin.yml is still very experimental
you can just use plugin.yml on paper as well
I changed to spigot, done mvn package command, still same error, tbh I have no ideia why
public final class Hockey extends JavaPlugin {
@Override
public void onEnable() {
createOjbects();
registerCommands();
this.getLogger().info("Hockey has been enabled!");
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
private void registerCommands() {
this.getCommand("puck").setExecutor(new PuckCommand(this));
}
private void createOjbects() { }
}
the plugin.yml
name: Hockey
version: '1.0'
main: pt.bonnie20402.hockey.Hockey
api-version: '1.19'
commands:
puck:
description: 'spawn a god damn puck'
I feel like it's such a small error but idk what's wrong
I mean
did you update the jar ? in the servers plugin dir
mvn package will output to the target dir
yes I did, I even removed all the jars before compiling
and I reloaded maven so it downloaded all the stuff it needed to
open your jar with any archive tool and make sure it contains the correct plugin.yml
U can use jdec online to check the plug-in.yml
it still has paper-plugin too idk why but here is it
Entity entity = Bukkit.getWorld("world").spawnEntity(p.getLocation() , EntityType.WITHER_SKELETON);
entity.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither");
entity.setCustomNameVisible(true);
entity.
i cant set the health
or equipment
or even get the inventory
of the entity
cast to WitherSkeleton
if im not mistaken you should have at least casted it to LivingEntity
^
((WitherSkeleton) entity).setHealth(5000); wont this work ?
it would
it should
fantastic
I mean I would just have it so that the variable is of the type WitherSkeleton from the very beginning
change Entity here to WitherSkeleton
and call it witherSkeleton respectively
oh
btw
there is a probleme
public class customitem implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(commandSender instanceof Player);
Player p =(Player) commandSender;```
i cant get the other args oncommand statement
strings
if i add it manually it gives me errors
its an array
the variable strings is an array
and that array contains all arguments
btw why do you have semicolon after if statement
so i just use strings for arguments ?
because the if statement ended ig
i recommend you to learn java just a little bit
; is wrong
iam kinda new to it tbh
or better early return
but that doenst gives me any errors
?conventions
;-;
As that's usually the norm
also in newer versions of java you can do this
if (commandSender instance of Player player) {
player.setHealth(10);
}
airforce, in java we have special syntax/grammar just like other programming languages, or normal languages such as english, french and so on, why u use {} and [] is because we decided to go with that grammatical syntax, just like why we use dots at the end of sentences.
now [] denotes an array, and { ... code here ... } denotes a scope
bug that doesnt give any errors is much worse than a bug that gives errors
๐ฎ
yeah airforce good analogy
: )
because you have to look for a bug manually
and if it causes errors you can easily find where the bug is
Depends on the entity
even after casting inventory i cant get its inventory
yes i used that
alr
can you send full code?
is it DAMAGE ALL ?
ItemStack Dia = new ItemStack(Material.DIAMOND_AXE);
ItemMeta e = Dia.getItemMeta();
e.addEnchant(Enchantment.DAMAGE_ALL , 30 , true);```
is it DAMAGE_ALL ?
Yes
and by keeping it true i can bypass the limit right ?
alr
by the way you shouldnt place extra space before comma
e.addEnchant(Enchantment.DAMAGE_ALL, 30, true);
this is how it should be
alr
done thanks
and ctrl alt o to remove unused imports
how do I remove endermite particles?
entity.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither");```
will that say in bold ?
You canโt use + with two chatColors
you can use ChatColor.BLUE.toString() + ChatColor.BOLD
However you can toString one
those are produced by the client -> you can't
Entity entity = Bukkit.getWorld("world").spawnEntity(p.getLocation(), EntityType.WITHER_SKELETON);
entity.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither");
entity.setCustomNameVisible(true);
((WitherSkeleton) entity).setHealth(5000);
((WitherSkeleton) entity).getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
((WitherSkeleton) entity).getEquipment().setItemInMainHand(new ItemStack(Dia));
its not working ;-;
i mean the name works
but not the casting
uh
i forgot how to code on bukkit
but i remember
Bukkit.getWorld("you").spawn(Zombie.class, i_think_this_is_location);
it's return object as class u typed
the casting isnt working
like
// will return Zombie
Zombie ent = Bukkit.getWorld("you").spawn(Zombie.class, i_think_this_is_location);
the spawn things works
but the casting deosnt work
like its health
and quipment
uh
the equipment also not working
Probably because of said error
plus cant we set it above the max health ?
No
WitherSkeleton ent = Bukkit.getWorld("world").spawn(WitherSkeleton.class, p.getLocation());
ent.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither");
ent.setCustomNameVisible(true);
ent.setMaxHealth(2048)d
ent.setHealth(2048);
ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
ent.getEquipment().setItemInMainHand(new ItemStack(Dia));
You need to raise the max health
or add some golden apple health ( i forgor its name)
whats that
you too lazy for what?
xd
to edit message
ok
backspace : )
Set it to null
it worked boiiiiiiiiiiii
ikr
i feel of my chair
fell*
done before any one corrects me : )
ItemStack Dia = new ItemStack(Material.DIAMOND_AXE);
ItemMeta e = Dia.getItemMeta();
e.addEnchant(Enchantment.DAMAGE_ALL,30 ,true);
p.getInventory().addItem(new ItemStack(Material.DIAMOND_CHESTPLATE));
p.getInventory().addItem(item);
WitherSkeleton ent = Bukkit.getWorld("world").spawn(p.getLocation() ,WitherSkeleton.class);
ent.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither");
ent.setCustomNameVisible(true);
ent.setMaxHealth(2048);
ent.setHealth(2048);
ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
ent.getEquipment().setItemInMainHand(new ItemStack(Dia));
return true;
}```
cant get that enchantment on the axe ;-;l
You never setItemMeta
heh ?
y
You need to use setItemMeta after modifying item meta
Dia.setItemMeta(e)
forgot that
camelCase for variable names
camalcase is () right
Modify the entity in the consumer (third argument)
no, its the case used for objects
lowerCamelCase to be exact
variableName, ClassName, CONSTANTS
i dont get it
its not working
?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.
imean the metadata
send code
also, contants do like CONSTANT_NAME instead of CONSTANTNAME afaik
ItemStack dia = new ItemStack(Material.DIAMOND_AXE);
ItemMeta e = dia.getItemMeta();
e.addEnchant(Enchantment.DAMAGE_ALL,30 ,true);
dia.setItemMeta(e);
p.getInventory().addItem(new ItemStack(Material.DIAMOND_CHESTPLATE));
p.getInventory().addItem(item);
WitherSkeleton ent = Bukkit.getWorld("world").spawn(p.getLocation() ,WitherSkeleton.class);
ent.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither");
ent.setCustomNameVisible(true);
ent.setMaxHealth(2048);
ent.setHealth(2048);
ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
ent.getEquipment().setItemInMainHand(new ItemStack(dia));
return true;
}```
i think the enchantment worked
where not workin
but its not sharpness 5
ig
like sharpness 30 is enough to 1 shot me
without armour
and its sharp5 ig
add enchantments in itemmeta
i did
ItemStack dia = new ItemStack(Material.DIAMOND_AXE);
ItemMeta e = dia.getItemMeta();
e.addEnchantment(Enchantment.DAMAGE_ALL, 30);
dia.setItemMeta(e);
i remove that true ?
so remove the true ?
What's a better way to check if a certain player is within the certain region (a square)?
- use a runnable that periodically checks for each online player location, etc..
- use PlayerMoveEvent?
performance wise?
ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE , 2 , 2));``` how to make duration infinite
infinate*
do i set it to 0 ?
what version
1.18.1
Integer.MAX_VALUE
i wanna say PME with ignoreCancelled = true
ty
so that would ignore it, when I do setCancelled(true)?
no
but if it is cancelled before ur method is called, ur method wont be called
thus avoiding unneccessary invocations
Alright, perfect, thank you
does it print anything at all?
if not make sure you actually registered the command
ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE ,Integer.MAX_VALUE,Integer.MAX_VALUE));``` it didnt gave the wither the effect ;-;
what is this
That will easily be bypassed
yeah some1 can create their own paste
Also if you use that you can't post the plugin on spigotmc
and woops, bypassed
if you actually want to use licensing, maybe some other authorization method should be used
mini up ๐ค
this license check looks weird
idk
scan will never close if firstLine contains true
moreover his url var is incorrect
no .com after pastebin
is Player#hasPlayedBefore() reliable?
is it consistent between offline-mode and online-mode server
i have these methods to hide and reveal players, my issue is that if the invisible player changes animations like swinging or eating they become revealed again when i dont want them to
i assume this is some sort of packet doing this, how can i fix that problem
Something tells me you have funky code interfering with you
Add some debug lines to make sure no other listeners are at fault
its not applying the effect bro
someone help me
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
?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.
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
can someone tell me why its not working
amplifier parameter should be between 0 and 255
that will solve the problem ?
it didnt gave the wither the effect ;-;
How would you figure out if player is facing towards the block to which he was denied to go to, on PlayerMoveEvent?
???
yes it didnt gave the wither strenght effect
The wither uses projectiles to deal damage. I don't think those are affected by potion effects.
Anyone have a decent InventoryManager api? all im finding are out of date ones that support 1.13.
Try the value between 0-255 in the amplifier param
what you mean by inventory manager
like an API that just makes it easier. for Pagination, identifying them, Manipulating a specific inventory, etc. The past 2 days i was trying to make my own, and its not going well.
alr
You'll have to build pagination and all on top
Okay, that's fine. I can work that out. thanks.
Or use something like IF or triumphgui
In my case I just use my own utils for literally everything
I like to use my own as well. Its just I cannot think on inventories, and also saving the data to files. its all just making my brain scramble lol.
break the task down to smaller pieces
Attempt 2 will be that ๐
very big problem this is code https://paste.md-5.net/etakexowih.cs
how to optimize this code
server stop then code try find location
no need to check if the world is null as you already check location
good now the code is 1 millisecond faster
)
Before you can teleport someone to another world, you need to create that world (Bukkit.getserver().createWorld()) but is there a way to see if it is already created, or does multiple creation dont matter?
use ints not doubles as you don't need double precision
use center.getBlockX() instead of getX()
etc
ok i do
also instead of check every block with an x/y/z loop you should create either a region or a BoundingBox and check overlaps
when the world already exists, createWorld just loads it
so you should only have to check if it's already loaded
For block breaking? and the sound when u break a block?
yes
What am I supposed to put for data in Player#playEffect?
it varies
Can someone help me please? For some reason no npc plugins are working on my server
I have tried 5 different plugins now.
I mean what does data represent?
it varies depending on the effect
would it be the block data id if I am playing the effect for breaking a block?
probably yes
eg STEP_SOUND public static final Effect STEP_SOUND Sound of a block breaking. Needs block ID as additional info.
Worked thanks
make it a passenger
Does anyone know this
So I'll tell you more about this
I have a region, in which players can break/place blocks, etc.. and I want to prevent the player from entering it, I have all I need, I implemented all of it, now i'm trying to figure out how to deny him from entering, by bouncing him back, sort of
bouncing him back FROM the block he was denied to go to
eg. they could enter the region backwards, so... they would bounce back..
well if you have a region then why not check if he's inside?
I can do that, but I want to use the bouncing back thing
try to optimize the regions by chunks
on PlayerMoveEvent
Bouncing them with a vector that goes towards the from location should work
so a negative vector? -1?
substract to and from
Unless they try to enter from the top, in which case you get a trampoline
and then normalise
Yeah that's another problem XD
Let me try this
That's a great idea
But actually coding it is hard
I've got two locations, 1 is the top on y axis, and the 2nd location is the lower y axis
that's how i calculate the square
and what stops you from getting the middle?