#help-development
1 messages · Page 608 of 1
Make sure your java file is using the right encoding
yep
UTF-8 should work
Also I assure you velocity works fine on players
Try utf 16
Don’t see why it wouldn’t
Surly would have been reported by now
Make sure you are on the latest build, make sure you aren’t messing with it in the velocity event
Make sure another plugin isn’t messing with the velocity event
Weird
utf8 should be working fine
You could try using the escaped Unicode version of the character
Which is \uXXXX
Must not have actually been on 8 even though it said it was
¯_(ツ)_/¯
because in code | actually means something, where as in config its just a string character
so if you want to use it, you need to ensure it is interpreted as a string character
Another question
is there a translator
for like
1000
to turn into 1k
or do i have to manually
You mean division?
depends on what you mean by splitting
but there is Java API for formatting numbers though
think even Apache and Guava have some stuff too
which are stuff shaded into spigot
probably a map
when you code a plugin in Kotlin, the compiled plugin .jar is in Java right?
my 2 braincells at 2 am cant handle google anymore
yes
so why that plugin i coded in Kotlin spams a ton of Kotlin class not found ... error
it was the first & last time i coded a plugin in Kotlin
probably because you used the wrong compiler
hey, is there a way to make a player use an item?
is there a getBlockAt for players (client side only)?
not sure what you mean client side only
I made updates with player.sendBlockChange
actually nvm i thought of a solution
nvm nvm i havent. wait so is there a way to get the blocks that was sent to the client. Right now i basically have two pillars for a claim wand that show each corner and im trying to make it so they can select another block and delete the other pillar. yk?
you would need to keep track of what you sent to do such things instead of tossing it away
alright thanks
is there a way to smoothly teleport a display entity?
or smoothly move it towards a location
from what i remember these dont do it smoothly
wdym interpolation
It’s a feature of display entities
That lets them smoothly transition from their old transformation to a new one
kk
I have a question
or make him right click to use the held item
Why do the config automaticly remove spaces? this to
#Configuration for the Ghost plugin
max_vl:
fly: 40
speed: 5
reach: 3
messages:
fly_alert: "§d§lGhost §8-> §b§l{player} §7failed Fly detection. Type: §dY §7VL: §d{violations} §7MAX-VL: §d{max_vl}"
speed_alert: "§d§lGhost §8-> &b§l{player} §7failed Speed detection. Type: §dXZ §7VL: §d{violations} §7MAX-VL: §d{max_vl}"
reach_alert: "§d§lGhost §8-> §b§l{player} §7failed Reach detection. VL: §d{violations} §7MAX-VL: §d{max_vl}"
commands:
fly: "/ghostkick {player}"
speed: "/ghostkick {player}"
reach: "/ghostkick {player}"
this:
#Configuration for the Ghost plugin
max_vl:
fly: 40
speed: 5
reach: 3
messages:
fly_alert: "§d§lGhost §8-> §b§l{player} §7failed Fly detection. Type: §dY §7VL: §d{violations} §7MAX-VL: §d{max_vl}"
speed_alert: "§d§lGhost §8-> &b§l{player} §7failed Speed detection. Type: §dXZ §7VL: §d{violations} §7MAX-VL: §d{max_vl}"
reach_alert: "§d§lGhost §8-> §b§l{player} §7failed Reach detection. VL: §d{violations} §7MAX-VL: §d{max_vl}"
commands:
fly: "/ghostkick {player}"
speed: "/ghostkick {player}"
reach: "/ghostkick {player}"
Because spigot doesn’t add any spaces when it saves a config from memory
It shouldn't be doing that anymore.
Comments and spaces are now preserved post 1.18.1
possibly try adding a \n to a comment
it should be retained and display as an empty line
If I have a 'craft x planks' as a quest, how can I keep track of that? The CraftItemEvent gives you a recipe and the inventory. You can use that to calculate the maximum amount that can be crafted, until you factor in the players inventory. Then when you're dealing with items with additional metadata, you'd have to compare all of that too. Is there a simpler way to do that?
Essentially it's a "can item A be added to item B's stack?"
How can I make a reload command that make up to date the config.yml ?
plugin.reloadConfig is the easiest way
Assuming you are only using the default config and are reading from the object each time
it doesn't work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
When I save a setting in config.yml and I do the command it does not work.
?notworking x2
"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.
Im getting an extremely weird concurrent modifiction exception on this for loop. The error is on the line that says "for"
for(String beeName: storedBeeNames) {
beeManager.spawnBee(customHive, beeName);
}
SpawnBee method:
public CustomBee spawnBee(CustomHive customHive, String beeName) {
Random babyRandom = new Random();
int roll = babyRandom.nextInt(0, 100);
boolean isBaby = roll > 50;
CustomBee customBee = new CustomBee(customHive.getHiveLocation().clone().add(0.5, 1, 0.5), ColorUtil.color(beeName), isBaby);
Bukkit.broadcastMessage(ColorUtil.color(beeName));
customHive.getBeeUUIDs().add(customBee.getUniqueId());
customHive.getBeeNames().add(customBee.getCustomName());
customBee.setCannotEnterHiveTicks(0);
cadiaBees.beeManager.setBeeToHiveMap(customHive, customBee.getUniqueId());
return customBee;
}
I dont see how anything could possibly be modified while looping
well you are adding to something
we don't know from that what your classes are doing
like what is CustomHive
we don't know what is going on there
what is storedBeeNames
?paste
also, it helps to show the full stack trace too
not just tell us what kind of error
since most don't even know how to read the stack traces
I am aware CustomHive is an object you made
because Concurrency doesn't just mean trying to remove and add at the same time
but also means from multiple sources
IE, maybe another thread
Im not modifying the list while looping over it though..
thats what i dont get.
customHive.getBeeUUIDs().add(customBee.getUniqueId());
customHive.getBeeNames().add(customBee.getCustomName());
it also only has the issue when I add the names, its fine with the UUIDs.
both done the same way.
what is on this line com.squallz.cadiabees.listeners.PlaceHiveListener.onHivePlace(PlaceHiveListener.java:123
for(String beeName: storedBeeNames) {
thats line 123
it gives me the CME, but the thing im actually doing there works 100% perfectly
List<String> storedBeeNames = new ArrayList<>();
if(pdcManager.isNewHive(heldItem)) {
storedBeeAmt = 1;
hiveLevel = hiveLevelManager.getHiveLevel(pdcManager.getStoredHiveLevel(heldItem));
storedBeeNames.add(ColorUtil.color("#6a06fbB#8c21fce#ae3bfde"));
customHive = new CustomHive(
UUID.randomUUID(),
heldItem.getItemMeta().getDisplayName(),
hiveLevel,
HiveStatus.PRODUCING,
storedBeeAmt,
0,
player.getUniqueId(),
beehive.getLocation(),
new ArrayList<>(),
storedBeeNames,
new ArrayList<>(),
new ArrayList<>()
);
}
"isNewHive" is just checking a namespacedkey on the itemstack.
its having an issue in regards to an itemstack
you don't need a method to allow access to things you don't handle just fyi
Wdym
That is used
no, it doesn't do anything is what I am saying
you could just make the list public instead
but getters are the proper way, no?
getter is pointless if the getter does nothing
it returns the private list
I mean I guess
anyways, is this being used in a concurrent way?
Which part?
well you can't only use partial of the object in concurrency either it is or isn't
its used all over the place
again it only has the issue with this "names" part, nothing else
Well Array Lists are not thread safe
no matter if you touch it or not, if its part of an object that is in a thread
and then something touches that list from the main thread
it will still throw a CME
wtf
however there is an easy fix well hopefully
just add synchronized to your array list methods
Which methods
any of them that touch Array Lists
whether its returning the list, to adding or removing
this forces anything that touches those methods to wait on whatever is to finish
ideally you should be making use of things that is thread safe though
if the object is intended to be used in multiple threads or in a concurrent way
I know this isnt the right channel, or anything but does anyone wanna be a dev for me
I added it to every single method that touches the beeNames list, still giving me the error
Such as?
The CME isn't thread related
List<String> beeNames = // ...
for (String beeName : beeNames) {
beeNames.add("");
}```
This is equivalent to what you're doing
How?
Your spawnBee() method is adding to beeNames while you're iterating over it
customHive.getBeeNames().add(customBee.getCustomName());
yep that is it
Im iterating over a list from the PDC and adding them to the CustomHive object
2 different things
CopyOnWriteArrayList is thread safe fyi
well actually, its a completely new arraylist.
Im making the arraylist, adding things to it, then looping over it afterwards
Well something in that loop is adding to that list
That's the only reason you'd get a CME pointing to that loop
Yeah, same ArrayList
but the bottom shouldnt run before the top..
theres quite a few things between there
Doesn't matter. If you were to print out storedBeeNames == customHive.getBeeNames() you would get true
How? its 2 different lists
How do you propose it's two different lists?
One is created in PlaceHiveListener, the other is created in CustomHive
can I SS this?
unless you are cloning them, the one in CustomHive doesn't go anywhere
I just dont get how its possible that it could be the same list
well show us how you think they are different
This snippet you sent here, https://paste.md-5.net/axaleqaxug.js
storedBeeNames
You're passing it to the constructor of CustomHive and you're iterating over it
beeManager#spawnBee(customHive, beeName) adds to CustomHive's beeNames list which you passed storedBeeNames to
I dont think so..
this is a big plugin its hard to explain everything going on just by pasting some code and trying to explain with text
can anyone join gen 1 so I can screenshare
what Choco said is indeed the problem
I still dont understand how, or how to solve it easily.
in your method to feed an array
make it clone it
and then only touch the clone in that method that needed the list
method to feed an array..
can you join vc so I can at least ss? you dont gotta talk or anything.
@worldly ingot ?
VC doesn't allow screen sharing here
you say that, but your error says otherwise
the simplest solution is in your Object clone the array
before doing anything
im not passing the list into the object.
but you are...
where
Choco already pointed it out to you
I dont see it
do you just not know how constructors work?
im grabbing the list from the object and adding an item to it
?paste
im not passing an entire list in
customHive.getBeeUUIDs().add(customBee.getUniqueId());
customHive.getBeeNames().add(customBee.getCustomName());
grabbing the list from the object and adding to it, not passing an entire list into the object.
and the one in my for loop is an entirely different list
Anyone know what the problem could be with this?
https://paste.md-5.net/ibafakiyoh.sql
your plugin name cant have a space in it.
Caused by: org.bukkit.plugin.InvalidDescriptionException: Restricted name, cannot use 0x20 (space character) in a plugin name.
use underscores in places of a space
name field in plugin.yml
hmm had the same reaction as me
not the issue.
org.bukkit.plugin.InvalidPluginException: Cannot find main class `org.psychicraft.testplugin.TestPlugin'
What could be causing this?
But the main class doesn't need to literally be named "main" does it?
so how do I make it recognize my main class?
Not verified? Upload screenshots here: https://prnt.sc/
this is so stupid bro
just trace where the list is going
shouldn't be that hard to see that something is being add or removed at the same time
if thats much of an issue I already gave you a list that is thread safe or made for concurrent stuff
Does anyone have experience placing default structures using the StructureManager? I'm trying to place one of the new Trail Ruins structures but the loadStructure function is returning a null Structure:
Bukkit.getStructureManager().loadStructure(Structure.TRAIL_RUINS.getKey(), true).place(getCenter(), true, StructureRotation.NONE, Mirror.NONE, -1, 1, new Random());```
I figured I could load the structure using https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/StructureManager.html
But does this represent the valid structure namespace?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/generator/structure/Structure.html
how can i create a command that opens up the anvil gui
and still uses all registered custom recipes
why does it say that OfflinePlayer.getName().toLowerCase() may produce 'NullPointerException
because its possible an offline player doesn't have a name
you can put in some arbitrary random UUID
and it'll return an offline Player Object
?jd-s
i using getOfflinePlayers()
Gets the player by the given UUID, regardless if they are offline or online.
This will return an object even if the player does not exist. To this method, all players will exist.
ok seriously though why cant i access spigotmc.org
cant access any development threads
try clearing cookies and cache
its still possible that Name is null, however IntelliJ is not smart when it comes to knowing nullability situationally
ignore the warning and move forward
are u rate limited
probably not
this is why i like eclipse
try changing your ip
isnt that a whole process
if you open ur inspect element it will tell u
depends where you live
for most people its just restarting their router though 😉
i've already done that
yk I had this same issue at school and could neever figure it out
im not even getting any error codes or anything, it's just stuck in an inifnite loading loop
Have similar problem few days ago. md_5 did migrated to new Cloudflare WAF and whitelisted me (or change general rules) to unblock me.
how did you solve it?
md_5 did changed the firewall rules in Cloudflare
You can try disabling all your extensions and test again, just to check if problem is on your end.
so that mightve fixed it for you but broke it for me
and also try it from your phone
lemme see
so we will see if Cloudflare is blocking your IP or not.
my phone works
hmm
it might be cause i do lots of web scraping
but like on other sites not spigot
and other sites most likelly have Cloudflare as well.
If you are web scraping just buy a cheap VPS, never do that on your network
but im not blocked from those
4 years too late 😅
Cloudflare give a thread score to each IP, as Spigot can be attacked more time, it can set lower tolerance for thread score.
damn
so im basically permanently blocked from spigot then huh
No Cloudflare doesn't do that
if you stop attacking other sites (web scraping) your threat score will also get lower.
already told you, the ip you are using must be block or something by cloudflare. The ip your isp assigns is dynamic
so after a bit of time you will get a new one
automatically?
yeah
well the thing is i kind of dont have a choice but to do it on my own ip
because cloudflare easily detects VPNs
sure I could use a VPS but that would take forever to test
you can use a vps as a vpn
anyways it usually takes 3-7 days for the isp to automatically refresh your ip
sometimes you can shorten this by resetting the modem
what does that mean
and how would that help with quick testing
well i already reset it twice today cause internet died
because you could still do the testing on your machine, but use the vps for its ip
Your traffic would go thru the VPS first and then the scraping would come from the IP of your VPS.
So your IP would then slowly become clean again
hmm
all a vpn is, is just a fancy proxy
well at that point why do i need a vps
cant i just use a proxy server
like a private one
proxy servers are different in that it makes use of software to re-route traffic as opposed to hardware where vpn's work
You can buy thousands of proxy IPs for cheap, but they are usually slow.
yeah and they give up they are a proxy too
so then your scraper can just change IPs every x minutes
the thing is im not even scraping that instensely
like i only run a script once or twice a month
which only lasts like 5-10 minutes
What are you even scraping if I might ask? There is usually a better solution to scraping...
its for fiverr
just a bunch of random shit
Would be better if you do it more regularly and slowly not 5-10 minutes at the time.
ill look into a digital ocean vps then tho
its probably nothing you even did
you are not the only one that may have used the ip you have
sounds like where ever you live that ISP is known to have people or bots doing shady stuff lol
I mean scraping for 5 to 10 minutes is basically an attack. So it makes sense for Cloudflare to mark your IP as shady
but if you do like 30 requests per every hours, it should be a lot more stealth.
and more like legit traffic
yeah but then i'd just have to leave my pc on for a lot longer
its just kinda annoying
and then sometimes it runs into an obscure error and i gotta restart it
cause web scraping is just really unpredictable
this is what makes a vps ideal for this
Scraper should never crash. Even if the error is detected. It should probably just ignore it and move on.
yes but sometimes it would be like a random popup that covers the "next" button
and then it becomes unclickable
i still try to make it ignore errors if possible, but sometimes it just doesn't work
Are you scraping like other gigs / prices and compare them?
sorry what
also how can I check if an itemstack is a weapon or piece of armor
without having to list out every single material
repositories {
maven { url "https://repo.dmulloy2.net/repository/public/" }
}
dependencies {
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
}```
am I going crazy or something? I'm trying to install protocollib, I'm following the instruction and putting this in build.gradle, but it will absolutely refuse to load it
2 of the 4 errors I'm getting are
Unexpected tokens (use ';' to separate expressions on the same line)
One is
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: public val NamedDomainObjectContainer<Configuration>.compileOnly: NamedDomainObjectProvider<Configuration> defined in org.gradle.kotlin.dsl
are you using kotlin or groovie it matters
you're using kotlin the example is in groovie
Oh
is it possible to get the material of an itemstack armor piece or weapon
without listing them all out manually
https://docs.gradle.org/current/userguide/kotlin_dsl.html, sorry this is best I can do Idfk kotlin its so cursed
wdym by this
wouldn't you just use ItemStack#getType
like I want to get Material.IRON from Material.IRON_SWORD somehow
if yknow what i mean
or Material.DIAMOND from MATERIAL.DIAMOND_HELMET
like get the material that is used to repair that item in an anvil
or do i have to manually list everything
regex I suppose is the only nice way
thats kinda scuffed tho
and also slow
whater copilot helped me type this abomination
only way, other than that I suppose you could do some MEMORY magic to make it fast with unsafe or JNI
what is that
sick of writing slow java code? just write C instead 
copilot in intellij?
you COULD just split the Material string using the "_" character
i use vscode, please dont kill me for it for the 70th time
repositories {
maven("https://repo.dmulloy2.net/repository/public/")
}
dependencies {
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
}```
this works, I looked at the article for five seconds I just realized kotlin had a pattern
yeah but kinda scuffed, and also a lot slower
man if you thing String#split is slow you need to get your priorities straight
it just bothers me lmfao
you might as well start doing manual Memory Management with Unsafe xD
it'll be slow, but it'll be unsafe as hell
i have no idea what that is
it allows fine tuned memory management
you get access to memory addresses etc though I believe they are phasing it out, though i forgot what they are replacing it with
i see
v
seriously thuogh just do String.split don't go fucking crazy :P
stop using java
go use C or Assembly
or just use pure JNI though it maybe slower with the overhead conversion
honestly considering learning it 😭
https://www.baeldung.com/jni this'll probably end up slower than String#split but go and try
JNI is going to be fun :D
maybe later
the thing is
i also just need a list
of all armor and tools
to check of an itemstack is a piece of gear
so either way i need to make a huge list
speed doesn't matter in that case
make it on startup
premature optimizations lead to bad code anyways
a variation of the split "_" idea from earlier
find if your itemstack.getType().toString() contains "HELMET", "CHESTPLATE", "LEGGINGS", "BOOTS", "SWORD", "AXE", etc.
would that work?
you'll still need a list to contain all those keywords but 6 elements is better than 50
I guess that could work
alright fine
i'll use split
im getting a headache from my own code lmao
This method is used with an Annotation to make Events like this
public void @Events void player(...) {}
But when trying loading it doesn't work even not displaying
Code for the "Manager": https://sourceb.in/mXfpaxOmN4
Code for the loader: https://sourceb.in/PBA115EF5i
Vault plugin. I'm currently using player names, but the API says that player names are deprecated and that I should use OfflinePlayers.
Would there be any benefits to switch to Offline players? Like performance?
that is an interesting way of arranging things
im trying to fix a code from an old API that's why
ah
offline players because some people use cracked servers
public void despawnHologram(Player player, Hologram hologram) throws InvocationTargetException {
List<Integer> holoIDs = hologram.getHoloIDs();
PacketContainer packet = this.protocolManager.createPacket(Server.ENTITY_DESTROY);
packet.getModifier().write(0, holoIDs);
this.protocolManager.sendServerPacket(player, packet);
}
Any idea why this isn't working for all players on the server? I'm running it in a for loop, and all players get the message along with it but its like it just chooses one random player to send the ENTITY_DESTROY packet to, and it doesnt send to anyone else
What is the difference?
if server is cracked or not, both have usernames anyways
and then getOfflinePlayer is depracated too...
ew protocol
#getOfflinePlayer(String name) is only deprecated because people kept storing player data using player names instead of UUIDs.
It's not going to be removed.
so according to the docs, you can use offlinePlayer for example if the player is not online and you still want to get their data and they've already joined your server in the past
you can use offlineplayer to get their data
or this
Not everyone likes typing up a 15 page essay in MLA formatted, works cited to send a packet
takes 2 lines
with mojang mappings
tfw apparently windows 12 is coming next year
Oh god no..
still can't believe microsoft told us windows 10 would be the last version
Kek
Wonder if it will have the same "restrictions" as to what hardware can run it as windows 11 did.
What color will they make the start button this time? Orange? Pink?
Great..
Why can't they just upgrade Windows 11?
because its microsoft
So computer manufactorers would need to buy new licenses just for Windows 12?
i mean probably not, windows 11 was free for 70% of people
they might do the same with windows 12
but i doubt it'll come out next year
there's no way
windows 11 ain't even close to done
Manufacturers still need to pay for it
i can see it in many of the programs
ye
like this is clearly from windows 10
ain't updated yet
not sure where you got this from
windows 11 wasn't really suppose to be a thing
someone caught a glimpse of something they weren't suppose to see and microsoft tried to capitalize on it because they saw people were interested
rushed something out the door and tried to call it good
reminds me of one of those cartoons where they try to sell you whatever it is you want even by dressing up something else to look like it XD
XD
I'm still in Windows 10, I don't like 11, too many animations, new taskbar looks like shit.. the OS have to be fast, snappy, I don't want translucent windows, I'm still kind of used to the good old Windows 7 which in my opinion was one of the best.
How can i convert an Arraylist to a ...String?
depends whats in the list
Enchants
iterate over each item and append it to a string
conflit.forEach(enchantment -> {}) so in this way?
You could use .stream() which a list has
list.stream().map(Object::toString).collect(Collectors.joining(", "))
or the other way
with a for loop
String enchantmentsString = "";
for (Enchantment s : list)
{
enchantmentsString += s.name() + " ";
}```
Or just
String.join(separator, arrayList)
But idk if this will actually return the enchantment name or rather the enchantment object
this doesn't work
probably this could help out on understanding what im doing, im taking from a config all the conflit enchants and put it then on a custom enchant
.stream() converts the arraylist to a list object,
.map(Object::toString) calls toString() on each mapped object... you could use lambda on this as well like so .map(element -> element.toString()),
the .collect(Collectors.joining(", ")) part collects the elements of the stream in a string,
and Collectors.joining(", ") specifies a delimeter between the strings, it returns a string that represents the concatenation of all the elements in the stream
You can use the for loop though, if it's more understanding to you 🙂
same as before code if you want it
ArrayList<Enchantment> conflit = new ArrayList<>();
for(String ignored : config.getStringList(main + name + "conflicts")) {
conflit.add(Enchantment.getByName(ignored));
}
enchantments.add(new CustomEnchants(id, name, maxLevel, false, cursed, target, conflit.stream().map(element -> element.toString()).collect(Collectors.joining(" ,"))));
Oh it's a constructor problem
yes
do you use the enchant enum names in config or actual names
enum names
print the list to console and check if its null/empty
Are these not supposed to be separated by a dot?
they are already seprated
Are you looking for value like so?
main:
name:
conflicts: <--- your value is here
yes
that would be
confilts:
- Luck
Then it should be
config.getStringList(main + "." + name + "." + "conflicts")
that something i already fixed
Ohh
i need only to make them to an ArrayList to a ...Enchants for the constructor
an array list would fit enchantment varargs
seems to not do that
use List<Enchantment> as the value, not ArrayList<Enchantment>
show the constructor
what does the error actually say, that constructor should accept a list
It needs a list of enchantments not strings
that's what intelli is saying https://imgur.com/a/Ph46n3O
its giving you a generic
pass the list conflicts list
without modifying its contents
enchantments.add(new CustomEnchants(id, name, maxLevel, false, cursed, target, conflit));
List<Enchantment> conflit = new ArrayList<>();
for(String ignored : config.getStringList(main + name + "conflicts")) {
conflit.add(Enchantment.getByName(ignored));
}
enchantments.add(new CustomEnchants(id, name, maxLevel, false, cursed, target, conflit));
can you use conflit.stream().toList(); ?
same
i can't
what java version are you on
Sorry 8
Yeah toList() was intruduced in java 16.. For what version are you developing the plugin?
my discord is dying, i cant see or read any messages
my discord too
1.12.2
discords coming back to life now
i was making an error and i needed to use .createEnchantment
use a higher jdk
rip
11 should work fine too
in my java version im using java 17 but on intelli im using 8
let me upgrade it
ok done
im disabling the feature for now
if i use kotlin would it just work the same as java except different syntax or are there changes in the spigot package
i know both but i prefer kotlin so thats why
building the plugin with mojang maps taking too long, is there a way to fix it?
run a mojmapped server and dont remap every build
do note you should only ever do this for testing and never in prod
wdym do not remap everybuild
add a profile in maven, only remap the plugin when its enabled
the part that takes the longest is the remapping, so your plugin uses obsfucated mappings to work on normal servers
Quick question, how do I prevent players from dropping loot when they die other than keep inventory?
Why not use keep inventory?
Because they get sent back to spawn and we want them to have no items in their inventory
Ah then just clear the drops
I'm developing a plugin that uses the Spigot API but I'm using paperMC server software to test it can I still ask questions about my plugin's development in here or should I use Spigot as server too?
yes to which one?
I know this :D
https://pastes.dev/tZUNDV87Yi
Does anyone know how to fix it?
I can't build the environment
is there a reason you are using dev mode?
Use CraftBukkit as library.
not supported?
wip
but accessing internals obviously is never supported, you should use the api instead, or if its missing something, suggest new api
it's a float
floating overfloating
@young knoll im too late
How so?
I have announced this weeks ago, was just too lazy to start until today
Boi you better round that float
get drops then clear
happy now?
ok i found the bug and it was kinda stupid, i imported org.bukkit not org.bukkit.x lol
turns out the "package" option isnt the package you gotta import its the package its in
so now it works (yay)
but my ide is bugged so i have to switch to replit (nay)
Oof
ye
lol
and if ur wondering how i can test it out, i open up a mc java server and connect via floodgate geysr
lol
does no one you know have a laptop or a pc?
we were travelling
and we had no need for i
it*
either way i'd have to buy minecraft java
or bedrock on the pc
i only have it on mobile
you could still test on ur phone but code on pc
eh alr
let's coding together
no
wdym its kotlin
they''re coding in kotlin
smh
lol
i mean java/typescript being my first programming language probably influenced the choice
for the love of god, disable weather on your test server, lol
yes, YESSSS, i am not the onlyone, there are still people out there >:)
yeah boiio
kotlin is just way cleaner then java
agree
and has more
also i have had a hatred for oop ever since i learnt js classes
js is also pain, use at least typescript then
Kotlin is a moderate language between
Java <-> Scala
less overpower
but rain is cozy :3
especially if it's 34°C outside in real life lol
its 38° Here
its so annoying, lol
cries in heat
Disabling rain sound in real life is harder
Yay i‘ll also get a thunderstorm
bros living in the sahara
i was in death valley in 2008 and they had a temperature of over 50°C
but it wasn't that bad because it wasn't humid at all
sorry that was me
meanwhile your skin slowly crisping
😮 i didnt know it was that hot there lmao
i live in aus and highest temperatures in summer are liek 41
We love global warming
its like 43-42 average even before evening
wow
thank god I got air conditioning
so true props to the dude that invented aircon
we need to reforest the earth, people keep talkin bout terraforming mars and venus, but we need to start terraforming EARTH
or weird random technologies. JUST REFOREST THE EARTH
it can also help provide food and help global hunger (or the economy)
tru
the economy if you're a politician, global hunger if you're a human
sometimes IJ's error messages are not very useful
that error should appear in line 5 and not 6 ff
you: forgets a bracket
IJ: yea lets add red lines on every line i can find in the file except for the line you need the bracket on
yeah it's a bit confusing lol
okay I don't really understand the purpose of the left and right rotations of displays, like wtf is this lol
how can I force a server side packet using protocol
Make it bigger than an entire mc world
reload what?
Help me to make a reload cmd
so when I save something in config and I do the cmd /ghost reload it make the config up to date in game
Just put yourPluginInstance.reloadConfig() in your command executor
package be.kod3ra.ghostac.cmd;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import be.kod3ra.ghostac.Main;
public class GhostReloadCommand implements CommandExecutor {
private final Main plugin;
public GhostReloadCommand(Main plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length > 0) {
sender.sendMessage("§cUsage: /ghost reload");
return true;
}
plugin.reloadConfig();
sender.sendMessage("§d§lGhost §8-> §7Plugin successfully reloaded.");
return true;
}
}
Command implementation seems good
Where class do you use the plugin#getConfig() ?
How you use the config
ok
getCommand("ghostreload").setExecutor(new GhostReloadCommand(this));
in public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
do
if (cmd.getName().equalsIgnoreCase("yourmaincmd"))
{
if (args[0].equalsInogreCase("reload"))
...
}
okay you said you typed command /ghost reload then your command name should be ghost
So you should getCommand("ghost")
else if (command.startsWith("/ghost reload")) {
event.setCancelled(true);
event.setMessage("/ghostreload");
Bukkit.dispatchCommand(event.getPlayer(), "ghostreload");
How do I specify doot
What is printing when you typed /ghost reload?
Slot*
§d§lGhost §8-> §7Plugin successfully reloaded.
do you cache the config in any classes
Then your config in your plugin reloaded well
So you need to find where you use the config
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player))
return false;
if (cmd.getName().equalsIgnoreCase("ghost")) {
if (args.length == 0) {
// .. your main command message without params
}
if (args.length == 1) {
if (args[0].equalsIgnoreCase("reload")) {
// your reload functionality..
<main_class>.saveConfig();
<main_class>.reloadConfig();
player.sendMessage("config reloaded");
}
}
}
return false;
}```
this fucking hurts me
why are you checking the command
is this possible ?
the class is only ever gonna be called for the commands its registered to
you still should never need to check the command name
You can if have just one class, it's bad practice but its still possible
it is not my code
spigot loads it for you
package be.kod3ra.ghostac.cmd;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import be.kod3ra.ghostac.Main;
public class GhostReloadCommand implements CommandExecutor {
private final Main plugin;
public GhostReloadCommand(Main plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length > 0) {
sender.sendMessage("§cUsage: /ghost reload");
return true;
}
plugin.reloadConfig();
sender.sendMessage("§d§lGhost §8-> §7Plugin successfully reloaded.");
return true;
}
}
this is my code but is doesn't work
You can use just reloadConfig() and when you use it just call getConfig()
I really need where you use the config
So if someone type ghost reload it will just send them usage message, as args.length > 0 will be true in that case
You loaded config and reloaded then you will use this config right?
ah
wdym?
how can i make an array of string work into this method, define(String @NotNull ... lines)?
@wild basin Let me see your whole code
wdym?
i have a string list like this
pattern:
- XXXXXXXXX
- XOOOOOOOX
- XXXXOXXXX
- XXXXOXXXX
- XXXXOXXXX
- XXXXOXXXX
and i wanted to use it for this method define(String @NotNull ... lines);
But java doesn't like this so how can i fix this?
toArray
What exactly it doesn't like
Why the not null annotation there
String[] myStrings = myList.toArray(new String[0]);
im using another dev api so idk
I mean in the middle of the param declaration
shouldnt u use String[]::new
the IntFunction is java 11 +
You can technically annotate varargs as @NotNull String @NotNull... args
Works thanks for the help
Just looks so wrong
It basically means that both list (array?) and their elements can't be null
someone know any api for discord connecting with minecraft ?
i mean if discord user connect account to ingame minecraft account
gets some features
Why do you need api for that
Just use some discord wrapper (jda) , and save uuid <-> discord snowflake yourself
wdym
u mean can i do this with database ?
test
why my messages isnot
Discord is lagging
discord is ded ?
is there bukkit server src
To make things easier, you can even run discord bot inside of spigot plugin
Sure lol
?paste
but i wanna do this with luckperms or permissionsplugins
do u have idea for do this ?
?stash If you think nms, I think there is no source online, for bukkit see this link
thats the api??
What does that have to do with anything
It's implementation and api source
hey, so i have a question. i'm not sure if this is possible? (i've tried recalculating permissions, but its not enough)
so if i set myself as op, all commands autofill (so if i type /setp, minecraft will give me all the options, /setperm being the one i want)
if i remove the op, and only maintain my owner rank (yes i am making a custom ranking thing, just for the fun of it), the autofill is gone
the command still works, i still have the perm and everything, but if im not op, the command just simply does not autofill
is there a way to fix that?
Everything that starts with "Craft" is implementation
is my brain not working or should this be false if (event.getAction() != Action.RIGHT_CLICK_AIR || event.getAction() != Action.RIGHT_CLICK_BLOCK) return; the action is right click air
Heya, I'm trying to display a webpage via some code, I have all the assets, htmls, css and js, but it doesn't render correctly, maybe someone has an idea?
https://paste.md-5.net/xusupidudi.java
(Left image is the website displayed b the code; Right is as it should be and how it is if I execute the html natively)
I do want to note, it seems that the css isn't really applying correctly, but idk why
Example CraftServer is impl of Server api
player#updateCommands()
as in what calls them or something
oh my god, i have no clue how i missed it, thank you
NVM, I see what's happening
Your css isn't linking somehow
oh yeah the craftbukkit has the stuff i need
Yeah and I just noticed that the request paths have a weird web/web directory in it, that's the issue
\plugins\PlayerDataManipulator/web/web/index.html
wait, no, now it's fine... well the paths, but not the site
Open site, press ctrl + u, and try opening css path it's linking to
See what it's trying to open
I'm letting the console print out what the server is requesting
And everything seems in order
Why does this happen when i run buildtools?
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 526 for URL: https://static.spigotmc.org/maven/apache-maven-3.6.0-bin.zip
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1997)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at java.base/java.net.URL.openStream(URL.java:1161)
at com.google.common.io.Resources$UrlByteSource.openStream(Resources.java:72)
at com.google.common.io.ByteSource.read(ByteSource.java:296)
at com.google.common.io.Resources.toByteArray(Resources.java:98)
at org.spigotmc.builder.Builder.download(Builder.java:1172)
at org.spigotmc.builder.Builder.main(Builder.java:394)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
seems to be linking the right files
Have you opened source with ctrl u
I have
And ctrl + click on css link, are you able to view that css?
ye
good to know that's an option
Dk then, sorry
Thanks for trying though :D
Tbh I would just use jetty or some library on top of it such as javalin then pure java httpserver,it seems like pain
Yeah, I already got a HTTPHandler for sending the data upon request
nooo, wtf happened
I mean
you set the content type of text/html
for everything
obviously that is not gonna work out
But I did link up the css using <link type="text/css" href="styles/editor.css" rel="stylesheet" />
Yea but your server response with a content type text/html
when the browser requests the css file
Which, your browser properly does not load
ahh, well that's an oopsie
so i had a plugin that registered a bunch of smithing recipes with armor and their respective ingots with custom metadata and stuff, and with 1.20 these recipes no longer register to the server. im assuming this is because of the armor template recipes and the server considering my custom recipes duplicates of those despite my custom recipes not having a template. is there any way to make these recipes register anyway?
Hi! I'm running into an issue,
When I set the playertime non-relative, it correctly freezes the time. But in-game you can still see the sun jitter up and down.
player.setPlayerTime(newPlayerTime, false);
I can;t find anything about this in the Spigot docs.
"the player's time is absolute and will not change its current time unless done so with setPlayerTime()."
Am I missing something here?
what is newPlayerTime
why? this uuid from other server (bungeecord)
Its a variable that is a long based on the current playertime and an increment. I'm running a task to slowly transition the day.
private void transitionPlayerTime(Player player, long targetTime) {
player.setPlayerTime(targetTime, false);
}
This has the same result, (e.g. removing the task).
Hi, how to set the tabcompletion of a command coming from another plugin?
i would assume you could listen to a TabCompleteEvent and check the plugin of the command it's coming from and then just change or set the suggestions
i have a command and it has to wait until another method is executed, how to implement this?
more details
/give @s player_head{SkullOwner:<username>} 1
Or /give @s minecraft:player_head if you want the default head
but tab completion is not an event (it's the same method as for a command) unless there is an event too?
TabCompleteEvent is an event that exists yes
look into bukkitrunnable/schedulers
👍
thanks
you can;t wait but you can use a CompletableFuture and move all teh code into there
do that task you need to wait on and then operate on teh result
i can return/edit thetabcopletion like "ontabcomplete"?
uh, yes
the method has a list of strings which is what the command typer will see
you can change this list or replace it entirely
how method use?
How do i get all players in a world?
So if i want a command that shows how many players there are in each world
Guess
declaration: package: org.bukkit, interface: World
I dont know how to use it
Its for when you type /list it sends this so there can be more worlds but it only sends for world a, b and c
A: players in world a B: players in world b C: players in world c
Iterate over Bukkit.getWorlds()
or iterate over players on the server and just get their world
its not difficult lol
how do I fix this
im pretty sure thats saying the connection is denied
I cant access the control panel
is it better?
will give it a try
yeah
how do I run it?
nginx or apache
switch (clickedItem.getItemMeta().getDisplayName()) { case "White": CColourUtils.setColour(p, CColour.WHITE); p.sendMessage(ChatColor.GOLD + "Your chat colour has been updated!"); case "§cRed": if (kills >= 10) { CColourUtils.setColour(p, CColour.RED); p.sendMessage(ChatColor.GOLD + "Your chat colour has been updated!"); } else { p.sendMessage(ChatColor.GOLD + "You don't have the required kills for that chat colour."); } }
Hey, im trying to use a switch statement to carry out different actions depending on what the item name of the clicked item is (1.20) however it just activates all of them. Am I doing something wrong with the switch statmenet?
you dont break, either add break; to the end of them all or use lambda type cases
case "e" -> {}
Use this format for send ur code
System.out.print("sesso");
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
👍 Thank you
Thank you <3, it works perfectly now
ight
If you feel you need performance further beyond Paper, I feel like maybe the issue isn't the server software, it's the plugins you're running ;p
You're really not going to get any better performance from a derivative fork of Paper
Maybe a few tens of nanoseconds that won't make a massive impact
oh nah its gonna be a server for like 6 players
with 32gb of ram im just cruious
curious
Oh then you really don't need anything more than Paper
You could probably even use Spigot if you really wanted to lol
insert java gc meme here
I agree
wait choco favors paper confirmed
what fork do you use choco
all the cool kids use yatopia
All the cool kids use mojang's server
truuuu, vanilla all the way
bruh im having errors wtf is
14:40:44 WARN]: **** FAILED TO BIND TO PORT!
how do i check whats using the port
depends on the os
linux
quick google should have yielded you either netstat or lsof
yeah i did netstat and its showing no processes
Or is the port already bound 🧠
Make sure another mc server isn't running the background
im pretty sure its not
Sometimes they don't close ports properly and don't shut down correctly
Pretty sure isnt really good enough
Use htop
💀
where is the port in htop
im hsoting my paper server on my pc rn lol it lags like crazy
Get a better pc then I suppose
Oh

Then get better internet
3060ti
I7 10700k
32gb ram
Sorry wrong thing
im not upgrading for years lol
yeah
Yeah you need better internet though
Public server on your home network
👍
Oof sounds risqué I like it
yez
i removed the ip from server.properties and it works now??
Yeah don't put anything in there
you fucked the IP up then 
I mean, it is nice if you want to bind to a specific subnet
yeah it doesnt let me connect in game.
You just turned off 99% of spigot owners :o xD
are you using ur public ip or localhost
public
pls no
theres ur issue
why
just don't put anything
im guessing you arent port forwarded
Hello, with custom npc how to execute a command to the player who clicks on it?
the vcn has 0.0.0.0/0 TCP 25565 25565
your PC cannot bind a port to the public facing IP address if your router
its not my pc
did you port forwarded on ur router
its not my pc
I mean, neither can your machine ?
what is it
google cloud

Google cloud ☁️

is it open in ufw or ip tables

i think its open in ufw
do ufw status
Status: active
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
A part of me feels like google cloud isn't gonna be great for mc servers
im going to sudo reboot
it should show something like this
it says nothing like that