#help-development
1 messages · Page 235 of 1
we can skip that then, I just want to make a server to test out my plugin i coded
how should I go about that?
i appreciate each of your responses btw
the best way is to use a plugin for your build tool, but for now you can just add your plugin to a normal server and join it using the ip ::1
is there a way to check if a command argument can be parsed into an int without outputting a ton of exceptions?
this is mainly due to the fact that modern cpus have tricks to speed up such things. Whenever the JVM can, it will invoke native code which sometimes will invoke known cpu extensions
there's a regex for it but you could just use a try-catch
yup :) you can actually see a disassembly of the JIT compiled code with tools like jitwatch
think you might like that
and maybe some others too
i think i've actually seen that before !! it was on a stackoverflow post for the bit permutations
thank you though, i'll have to bookmark it this time :)
Do I need to load a chunk to get the chunksnapshot
I dont really understand how they work
I believe the method to get the chunksnapshot automatically loads the chunk
can't really get a snapshot of something the server doesn't have loaded
its like asking can you look at a picture of nothing
I'm trying to create a player_ec table with 7 strings: 1 uuid and 6 ec that are using base64 to convert them, but I'm getting an error. Here is the statement I'm trying to use and the image is the error.
String sql2 = "CREATE TABLE IF NOT EXISTS player_ec(uuid varchar(36) primary key, firstec str, secondec str, thirdec str, fourthec str, fifthec str, sixthec str)";
(I have also tried for all of the strings, using string instead of str)
wtf is a str
bro idk I was trying different things to see if they would work instead of string
but didnt work
I did try string btw xd
ok ok I didnt know'
what do you want to store in there ?
idk the size xd
TINYTEXT would hold up to 255 chars
show your code please
oh ok ima use mediumtext cus idk how big it is
this is just a choice of what datatype
yea mediumtext should contain pretty much whatever
ye its prob pretty big if it stores a whole inv in one string
ideally you should be using the smallest type necessary
👀
MEDIUMTEXT might be a bit large for a base64 inv
plain TEXT should probably workout
or just MEDIUMBLOB if you have the bytes
ye but text wants a size
nah
idk the size xd
you can just not specify it
ahh ok
goes up to 65,535 bytes
so just TEXT or TEXT()?
just TEXT
tho I presume
urgh
probably MEDIUMTEXt
just for those fuckers that have 50 shulkers
with stuff inside
ok xd
I always am confused why every mysql statement ppl write is all caps even tho it doesnt need to be
not all but mostly
I mean, conventions be conventions
store it as a BLOB
BLOB can store 65,535 bytes
indeed
lag out server xd
if you convert to base64 and then grab the bytes, I doubt you will exceed the limit for BLOB
but if you really want more room go with mediumblob, you can store 16mb worth of binary data with that
which is actually quite a lot
yea mediumtext or mediumblob is my recommendation too
I wouldn't store it as text mainly because in terms of space for DB text takes up more
well they are also new
true dat
and don't know about these things yet 🙂
which is why I wanted to see their code for sql
because odds are they are doing some other things wrong
or not the appropriate way anyways
Like me when I do sql
I tried using the Chunksnapshot thingy and it works not too well,
I need to teleport my player on a solid block and air above that
cs is a ChunkSnapshot
if( cs.getBlockType(x, y, z).equals(Material.AIR)) ) //doesnt work
if( cs.getBlockType(x, y, z).isSolid() ) //doesnt work
my plugin works if I use the world.getBlock command
cause the World.getBlock could cause performance issues
cs.getBlockType(x, y, z).isAir()?
yes but getting a chunk and snapshotting it does the same thing
the reason World#getBlock causes issues is cuz you need to load the chunk for that iirc
But you also load the chunk to snapshot it
I am new to all of this I tried snapshots for the firsttime and hoped that the isSolid would work
yess
but with nether its annoying because getting the maxheight is always the bedrockroof
ahh
well you need to first look for air
send what you have thus far
the entire thing
?paste
I have it working without snapshots
oh...
you sure you tried it enough without snapshots to say for sure it works without?
its getting the chunk coordinates
because with (x % 16) you can get negative modulo so i add 16 and mod again
if (-18 % 16) = -2
why are you getting the modulo for a chunk x
World X / 16 = chunk x
you already generated a chunk x
ChunkSnapshot c = world.getChunkAt(x, z).getChunkSnapshot();
//Chunkcoordinates
int cx = ((x % 16 + 16) % 16);
int cz = ((z % 16 + 16) % 16);
because c.getBlockType(cx, y, cz) expects 0-15 for x and z
exactly
that wouldn't be the correct math
so use a for loop and loop from 0-15
oops
what that would do is return the remainder
I dont understand you I think you are wrong
why would I loop from 0-15
it needs to be floor(x/16)
yes
yes I am listening
we need to do
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
}
}
and check each x and z combination for air
sure
x = rand.nextInt((rangeMax - rangeMin) + 1) + rangeMin;
z = rand.nextInt((rangeMax - rangeMin) + 1) + rangeMin;
World world = Bukkit.getWorld(worldname);
ChunkSnapshot c = world.getChunkAt(x, z).getChunkSnapshot();
//Chunkcoordinates
int cx = ((x % 16 + 16) % 16);
int cz = ((z % 16 + 16) % 16);
p.sendMessage("x: "+ x +" cx: "+ cx + " z: "+ z + " cz: " + cz);
for(y = 105; y > 30; y--){
if(c.getBlockType(cx, y, cz).isAir() ){
if(c.getBlockType(cx, (y-1) , cz).isAir()){
if (c.getBlockType(cx, (y-2), cz).isSolid()) {
Location loc = new Location(world, x, (y-1), z).add(0.5, 0.5, 0.5);
p.sendMessage("You will be send to: "+ x +" "+ y + " "+ z);
return (loc);
}
}
}
}
what you do here is get a random chunk and snapshot it
let's assume its Chunk(4,3)
which would have an origin at (64,0,48)
you then calculate cx and cz which according to your code is 4 and 3
that means you're only checking one row of blocks in the chunk
since youre getting the block at (cx, y, cz)
cx and cz are fixed
you need to check all x and z values in the chunk
?paste
k thank you I will look if it helps me
I am not sure if you understood what I was trying to do
I am getting a random x and z coordinate
Snapshotting the Chunk in which those coordinates are
finding out which chunkcoordinates in the chunk represent x and z (cx: x in chunk c)
Iterating from the roof downwards to find a solid block with enough space
I was never trying to find an empty block in the chunk , I was just trying to find an empty block at exactly that one coordinate(x,z)
why are you doing step 3?
because of this
I was trying to implement getmaxHeightYAt for the nether
also you're generating a random location
see if this is what you wanted in the first place though
well idk Its my first plugin
iterating from the roof down will take longer then iterating from 0 up
its not, I think
there is more empty blocks between the ground and height ceiling which is now at 256
@wet breach are you able to confirm?
then there is between the ground and 0
this is correct, however there is methods that autoload the chunk at the same time too
frostalf true I might change that I wouldnt be getting the heighest block but its not really what i cared about
uhm what my main problem was that the ChunkSnapshot seem unusable cause the isSolid() doesnt work with them
I know this, but you want a solid block, so it usually better to start at a place where it would take the shortest time
I've looked everywhere. Is there a way to give an entity the texture & AI of a mob already in the game?
you would have to use NMS and custom entity
ah, okay.
yes, I'm creating a custom entity. I'll go look over NMS rn
Thanks to everyone for the help even tho I was saying confusing shit
the easiest method might be to use packets most likely
I mean if you don't need custom AI and stuff, you could just spawn the entity you want the AI of
and then use packets to disguise it as some other entity
Wouldnt this help him? https://github.com/unnamed/hephaestus-engine
maybe, I am not familiar with that
I'm getting this error when trying to build: Could not resolve org.spigotmc
1.8.8-R0.1-SNAPSHOT. could anyone help?
Should I send the whole build file?
?paste
Try
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
I should put that in dependencies instead of the CompileOnly?
Or I should put it outside of it?
Replace compileOnly("org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT") with compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
An they just go under the other maven one you have.
Thank you, that fixed that error but now I'm getting an error with my import net.minecraft.server.v1_8_R3.Tuple;
An what's the error?
All my imports with net.minecraft.server.v1_8_R3 are no longer working, error: package net.minecraft.server.v1_8_R3 does not exist
Hmm try removing the -api from spigot-api
I think spigot-api is for the newer versions
I'm getting the same issues as earlier, could something be wrong with my pom? I am using code a developer sent me could that be an issue too?
Have you ran buildtools for 1.8.8 on your pc yet?
I haven't
How do I do that?
I can put java -jar BuildTools.jar --rev 1.8.8 in the cmd?
https://www.spigotmc.org/wiki/buildtools/#running-buildtools Download the Buildtools jar and do java -jar BuildTools.jar --rev 1.8.8
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
did mojang ever fix the link with 1.8.8 vanilla server jar?
if not you are not going to be able to build the 1.8 version
at least not with buildtools anyways
I am trying to run the command but it's saying it's unable to access BuildTools.jar
Are you running the command in the directory from where you download the buildtools jar to
I just did that and now it says my Java version is to high. Do i need to goto Java 8 in order to do this? If so how can I switch back?
What Java version are you running?
11
11 should work, but may need java 8
Makes sense lol
has to do with the decompiling process
do you know if mojang fixed being able to access the vanilla server jar for 1.8?
No idea. I haven't dealt with 1.8 in years.
same, but anyways the link for downloading 1.8 either got removed or restricted
if they have not fixed it, then you can't use buildtools to get 1.8
need the vanilla server jar first for buildtools to work lol
well buildtools fetches it, but its one of the first things it does
I'd test it but can't be bothered reverting my java haha
I get this error: Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [bash, applyPatches.sh]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:976)
at org.spigotmc.builder.Builder.runProcess(Builder.java:907)
at org.spigotmc.builder.Builder.main(Builder.java:706)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
It took me a minute to revert back to older java versions
You on linux or Windows
Windows
Is there a way to remove the name of an item? I've tried setting it to null and to just "", but it just reverts it back to it's vanilla name.
show the full log
not just the error
Is this enough: Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true
applyPatches.sh: line 2: $'\r': command not found
Rebuilding Forked projects....
applyPatches.sh: line 6: $'\r': command not found
applyPatches.sh: line 7: syntax error near unexpected token $'{\r'' applyPatches.sh: line 7: function applyPatch {
'
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [bash, applyPatches.sh]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:976)
at org.spigotmc.builder.Builder.runProcess(Builder.java:907)
at org.spigotmc.builder.Builder.main(Builder.java:706)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
?paste
The Full Log
I wasn't sure if that wasn't enough so here is the full log https://paste.md-5.net/yosohedeto.rb
try deleting everything except buildtools.jar
Deleting everything?
also are you using command prompt or gitbash?
Yes
that is your problem right there
use gitbash instead
right click in the directory you have buildtools
select open gitbash
then run that command again
it should work this time
Yeah you'll need to for compiling 1.8.8
that why i have 2 env vars
so i just either run java8 or java17 depending what i need to compile
I figured it out now I'm getting this: https://paste.md-5.net/bodagazusa.sql
I think I just need to run as admin trying again
yeah, looks like 1.8.8 is dead?
YEah, it's still broken by the looks of it
how to spawn someone right infront of player ?
in 1 block distance
how to calculate that location?
Wrong
Location frontOfPlayer = player.getLocation().add(player.getLocation().getDirection());
thankuy!
Man that code could be really shortened lol
I'd do that first then worry about bugs or issues
Okay I got my project almost compiling! It's just that the specialsource-maven-plugin throws this: Failed to execute goal net.md-5:specialsource-maven-plugin:1.2.4:remap (remap-obf) on project nms-library: Error creating remapped jar: Unsupported class file major version 63 -> [Help 1]
Basically it doesn't support java19
rekt
fr
use 17
doesn't 1.19 use 19?
probably not as it's not LTS
correct
you can just use an array
ItemStack[] stacks = new ItemStack { ... };
stacks[e.getSlot()];
I already said that lmfao
two points
why are you creating a new ArrayList just to wrap an ArrayList?
why are you assigning it to an ArrayList<ItemStack> when you can simply use List<ItemStack>
and also fyi you have two ;
new new new new new new new
even better is, they could just use the add method on the already created list lmao
^
yep
it literally makes a new one
you should always use the weaker type if possible
even in method params/variables
ArrayList<MyThing> things; // bad, List<MyThing> can't be assigned
List<MyThing> things; // good, both List<MyThing> and ArrayList<MyThing> can be assigned
well its like this really
List<ItemStack> items = new ArrayList<>();
and then they can do items.add(ItemStack)
or whatever it is they require
Artifact sorting is a bit problem on intellij
As an example, Vault API just uploads 1 more spigot api(1.13) when it is not able to detect the original version of spigot because it is not a more prioritied artifact than spigot so it always uses the 1.13 spigot. Its like hell.
Nvm you got the point
Be careful
Is there anyway to give permission to player?
It's easier to use a permission plugins api. Like LuckpermsAPI if you're wanting to give permissions through code.
what?
artifact priority is controlled first by the order the dependencies are listed
second, you can exclude transitive dependencies
for (let i=1;i<7;i++) {
const countDiceBonus = posible1tm6[i-1].innerHTML
totalDiceValueBonus.push(number(countDiceBonus)) <----- adding 'number()' solved it
}
console.log(totalDiceValueBonus)
console.log(totalDiceValueBonus.reduce((accumulator, currentValue) => accumulator + currentValue, initialValueTEST));
}
Output:
(6) ['4', '2', '0', '0', '0', '0']
0420000
I expected totalDiceValueBonus.reduce to give me 6 for this instance, what am I doing wrong?
it sums the chars i would assume
i dont know js, but you would have to parse it somehow ig
no it makes an immutable list
its called an ArrayList but its not the same type as java.util.ArrayList
its literally an immutable list which wraps an array
does somebody know how i can turn on tnt duper on spigot servers???
Arrays.asList doesnt create a normal arraylist
yeah
Spigot still attempts to be reasonably close to vanilla behaviour
Paper on the other hand - they disable dupes - but if the dupe does not exist on spigot and especially not in vanilla then there is no chance that it will be a toggleable thing unless you use another fork entirely that specialises in allowing dupes
I'm making a duels plugin, and currently I have a void world where I add arenas and teleport players there.
What would be the best way to paste in arenas to the void world? The WorldEdit API? It seems to use quite alot of performance.
maybe paste in a fixed number of arenas of each map so you always have like 50 arenas
then you just have to load them
ok, and just like adjust if i ever needed more
but i wont
which dynamically pastes arenas if you need more
and extend the lines
how would i do that tho, i'd have a preset world
and replace the world with the preset world
everytime the server starts
public static final int GRID_CELL_W = 240; // x
public static final int GRID_CELL_H = 240; // z
public static final int INIT_GRID_SIZE = 20; // 20 x 20
public void setupWorld(World w) {
for (int xi = 0; i < INIT_GRID_SIZE; xi++) {
int xc = xi * GRID_CELL_W; // x coord
for (int zi = 0; i < INIT_GRID_SIZE; zi++) {
int zc = zi * GRID_CELL_H; // z coord
pasteArena(w, xc, zc);
}
}
}
maybe smth like this
you could do this asynchronously i think
to not slow down the server start too much
nah i could just have a preset world tho?
true
like make one
also
unrelated but kinda related
once i tp two players into an arena
and the match statrs
say its uhc and they have blocks
i want them to be able to place and break blocks
but not pre existing blocks
how would smth like that look
keep a set of placed blocks
and dont allow removal if it is not in that set
whenever they place a block
keep it in a
set
and
whenever they break
check if its in that set
and if it is allow
yeah thats what im saying
You store which blocks were placed and check if the broken block is stored in the block break event. You can also use that set to clean up the arena after the round ended, ya
and then to reset the arena
just remove all those blocks
i guess
or re-copy a schematic but that would require the admins to put schems of each arena too
schematic seems heavy on performance
especially if multiple matches are being started at once
since im just hosting this as a little project
i want it to be pr light
I'm in intellij and I'm having a problem with my local imports (trying to import something from one file while i'm working on another in the same folder)
heh show me
I can't send pictures
uh you can verify or use some paste service thing
?paste
?img
Not verified? Upload screenshots here: https://prnt.sc/
Hello, I'm new to Guice and my plugin depends on Vault's Economy and Permission interfaces, so I created this module: https://pastebin.com/RZNFFqcy
I was wondering if that's considered an abuse since I run logic when the requested service is not installed on the server?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I don't think so
are you replying to me?
All depends on to what extent you wanna use guice, and how decoupled your system is going to be
no sorry
What's generally considered the better way to create inventories? I've seen the use of an inventory holder, or a map of player names and the inventory. Is there a reason to use one over the other?
wdym by a map of player names and the inventory
I want to use a DI framework to get rid of maintaining like 1k constructors that have repeating dependencies(interface + only 1 implementation of it) - such as Economy and other services in the plugin
it's a pain in the ass to manually write constructors all the time
Sounds like a design issue moreover
You should split your components up into smaller parts, use builders etc
which I of course do
but it becomes a pain in the ass once the project is large enough
example:
Cause if a component itself depends on a lot of other components arguably that component is relying on too much external
Ik what you mean
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
my inventory framework is designed as a Map<Inventory, InventoryGui> and the latter handles all clicks and optionally keeps track of all the viewers
And those services would of course be used in many other places, but it's a pain to pass and maintain them every time
I'm starting to have more than 10 services, which SRP likes but I don't xd
Thats the thing, right now it looks like you send your highest level components down to the lowest level ones in one go
A map, with player names as the keys, and the result of Bukkit.createInventory as the values
what do you mean?
you just want to keep track of the viewers ig?
hmm anyways is exposing iterators over collections considered good practice or are there better alternatives?
It's a pain in the ass afterwards to convert the iterator to a collection again, so just expose defensive copies
public Set<User> getUsers()
{
return new HashSet<>(this.users);
}```
it's also the recommended way by Effective Java
hmm i started using iterators because i just needed to iterate over it
return an immutable copy
why not a defensive copy? easier to use if needed
contains checks aren't suitable on iterators
if i dont need them
A defensive copy isn't explicit on whether it is a copy, or an actual mutable collection
You should never return a mutable collection
the end user just assumes it's the original collection
Collections.unmodifiableX
^
also that should be specified in the docs if it's mutable or not
your defensive copy is still mutable, but it modifies the copy instead of the original collection
imagine having docs lmao
exactly, so the original list is defended
what's wrong with that?
it's just the code on the user's end that suddenly became less ugly
it doesn't
I'm convinced now.
Set<Whatever> set = Collections.unmodifiableSet(original)
👀
it's still the same
?
This code goes in the method that returns the list
how is it the same?
and it backs the list you want to expose right?
yes, but you need to do new HashSet<>(unmodifiableSet); if you want to use it
iirc
so whenever i add something to the orginal its wrapper is aware of it too
which is ugly
The problem with returning an immutable copy is that it might be overlooked by the consumer, unless you annotate with @Unmodifiable or something
thats what i usually try to do but always forget lol
You can just make it return an immutableset
and still just use the Set<whatever>
so like
Yes but that breaks the contract of the method to some extent
hmm
Basically violating liskovs substitution principle
Basically Collections#unmodifiableX methods should have never been added
Myeah Idk any longer whats best tbh
I mean it has its usecases
But nowadays Set::copyOf and ::of as well as Map::of and ::copyOf exist
probably slower to create than a unmodifiable wrapper
A bit myeah
Can you explain what you meant regarding my question?
assuming you want to alter the collection it could be useful ig
here
Well command classes are low level
They are just some implementations of HOW your command interface works
And these services sound like quite high level
I don't understand what's wrong?
You should have one or more middle layers that reduce the amount of dependencies and simplify the contact between the high level ones and the low level ones
Is it bad that I have no idea what y’all are talking about
I can very easily get rid of CurseService and put its content in ChatService, but this is how you violate SRP and create a god object
well if you go on to do it in an enterprise way, (which I assume you wanted to do since you use guice)
?
SRP means that one a class must only have one major reason to change
You don’t have to get rid of them
huh?
it means the class only serves one purpose
This is the formal definition
okay, how would you refactor the code to reduce the amount of dependencies?
because it's a boilerplate nightmare once you have more than 5 in a class
No not refactor, but instead create an internal api for your low level components
So they dont directly talk to the highest level ones
can you maybe send a uml example? I really have no idea how to implement that(not technically but in my imagination)
hehe typing on phone again
These methods are incredibly important when working with collections of larger size (or just high-throughput operations) or when the internal collection may not be modified and the returned collection must correspond to the internal collection. While sure you can do a desync-on-write type of thing but that'd be prone to hard-to-debug bugs
Plus the thread-safety aspect shouldn't be completely ignored when working with a desync-on-write/lazy-copy collection
Well I do accept the efficiency claim, but I noticed that copying even 1 million elements from one list/set to another didn't take longer than 100ms
just wanted to say that thats two ticks but i dont think mc has collections with over a millions elements smh
I once was bored so I decided to test that
lol
Differences compound. totalTime = singleTime * count. Inadvertently copying a million object long array once is no big deal. Copying it a few million times? No dice.
I agree, but when in reality would you do millions of copies from one collection to another? wouldn't that be considered as a potential code smell?
Sometimes it is easier to just optimize the collection than to optimize the consumer
I know this sounds far-fetched so let's give an example:
- Claiming plugin A maps each block to a claim. This is stored in a glorified Map<Location, Claim>
- As you can imagine that map is going to have millions of entries
- Plugin B wishes to render all the claims to an image.
- Plugin B may under no circumstance change that map directly as it would break quite a lot of things
I'm gettgin package org.bukkit does not exist when I try to build my jar anyone have an idea?
If you were to copy the list even once you essentially retrieve something from the collection twice. You can optimize it by listening for changes and all that but in the end you'll have two different collections that have exactly the same contents.
However If you were to just provide an immutable collection that pass-throughs to the internal list it would go much quicker.
Maven, Eclipse JDT or Gradle?
i'm trying to use maven package
So you are using maven and no other build tool (such as Eclipse's export menu or whatever IntelliJ's pendant is)?
I'm going into intellij running maven package is there another way I should do this?
using artifacts or the right hand maven menu?
I tried looking into my gradle to see if it was missing anything but It works just fine unless I am trying to download it
wait are you using maven or gradle now
I'm now getting build errors as well java: package com.sk89q.worldedit does not exist
Maven or gradle though
Here is my gradle: https://paste.md-5.net/hejegawahi.cs
i started getting errors when I tried doing my mvn package
why combing maven with gradle 🤔
So I should delete my gradle file?
idk what you wanna use lol
I can delete my maven how would I do it with gradle to build to jar?
I have a method that takes in an inventory. I want to get the title of the inventory but I literally cannot seem to be able to do it. Does anyone know how I can get the title of this Inventory object?
idk how gradle works
InventoryView#getTitle right?
Ctrl crtl twice then type gradlew build
or was it InventoryHolder#getTitle
InventoryView
I tried inventory.getType().getname didnt work, I have tried.getname doesnt exist, I have tried.getViewers().get(0).getOpenInventory().getTitle()
InventoryHolder is roughly equivalent to player (exact implementor depends on the circumstances)
I have tried inventory.getview.gettitle
hmm thought that
where to find the jar folder?
yeah
because there's no true reason
unless you're doing some extremely fancy stuff
but even then
Build/libs
there's probably a better way
so in my base64 I can put a title at the end and then take the title out when I use frombase64 because for some reason the method I got doesnt save the inventory name
mans tryna store a whole inv in base64
;-;
whats the reason youre saving an inv anyways
oh xd
i told him to do that instead of a db ;-;
lol
i saved invs in base64 before too
shouldve done it in binary
Asking about your attempted solution rather than your actual problem
as we grab 1 long (8 bytes, or 64 bits) and represent it with a single character
and do some padding
🤡
but seriously how can I get the title or save it in my base64 and btw I did this only cus I know the length of each title
why do you need to save the title?
bruh ;-;
this
again, do you NEED to save the inventory names? What inventories are you trying to save
yes they are inventory pages for my server and I save the inventory for each player when they close the inventory so I need to be able to know what inventory they have open with the title
at that point id just use gson or smth
hm oh wait
I could just set the title when they open inv
;-;
im kinda stupid sometimes
Lol
thats why I was asking, if its a constant title with minor changes, you shouldent have to save it
how can i downlaod buildtool.jar
?bt
yea but i dont understand it
One sec
How would I go about making something happen at a regular interval, for instance have a message broadcast every hour on a server?
use BukkitScheduler::runTaskTimer or use a ScheduledExecutorService or whatever its called
on what?
not talking to you
ok sry
?
yea i alr downloaded it but i dont know how i cna bring it to my server so it turns the paper server into a spigot server
Turning paper into spigot is dangerous, perhaps even not possible
but i thought it would work with buildtools
Buildtools just builds the spigot server jar
hmmm
how do i use compareTo() and what is this
but how cna i turn tnt dupers on paper server on??
i know how
how?
go to the files of paper
Somewhere in the config folder
ok
Paper-wolrd-defaults or paper -global
?whereami
damn beat me to it
?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.
Hello friends , i need some ideas on something :
iam creating a quest for skywars what is the quest?
when game start , you must be the first one to open a middle chest!
how i can check for that? there is 3 method in the in the api , i will provide a picture :
how do i use compareTo() and what is this
the quest is : be the first person to open a middle chest!
?jd-s
its oky , i dont want code , i just want ideas lol
Google your question before asking it:
https://www.google.com/
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.
i saw a few websites but idk
i am learning java
on programmingbydoing
can you explain to me
a little better
compareTo is used to implement sorting
How can I create heads using custom textures (using urls)?
It basically returns the "distance" of an object to another
For a.compareTo(b):
- 0 means a and b are at the same place
- < 0 means b is left to a (or the other way around depending on your representation)
-
0 means a is left to b (or see above comment)
up
@buoyant violet If you still have no idea, see https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html#compareTo(java.lang.String). If you STILL have no idea, you should go to sleep if you are tired or drunk or you should wait a few months until it clicks
Hi guys
Hello
I'm trying to implement a function to make the player able to climb walls, like a spider 🤔
Sure
my idea is to spawn invisible ladders in front of the player when a block is in front of them
not sure if thats possible
oooh
Idk how to do It, but thanks, now I know there is a way
I mean, creating custom blocks
Custom Models, you can customize an item, give it a data and then make a texture of which material that item has been done
So you will be able to make invisible ladder
You could spawn a vine block behind them I believe, but idk
i dont know what it says
nice
i am italian
If you do this for uni or comparable, you should seriously rethink your choice unless you are tired, drunk or otherwise limited mentally at the very moment
compareTo(); compares two
I mostly use them in BigDecimals
It's not going to get better. Though if this is the first time you are stumbling on something I guess you are still in the clear
i need to create an alphabetic order
ehh that's annoying
you gotta spawn vines with a wall-detection algorithm
if (name.compareTo("myOtherString") < 0) {
System.out.println("https://www.youtube.com/watch?v=O2W0N3uKXmo")
}
is there an event when you jump onto a field and what is on it is mined?
?jd-s
Most likely player interact event
https://github.com/Geolykt/Presence/blob/main/src/main/java/de/geolykt/presence/PresenceListener.java#L115 yep, player interact event
public boolean registerFlags() {
try {
SimpleFlagRegistry flags = (SimpleFlagRegistry)this.plugin.wg.getFlagRegistry();
flags.setInitialized(false);
the .getFlagRegistry(); is red, I'm not sure what the problem is
this.plugin.getServer().getScheduler().scheduleSyncDelayedTask((Plugin)this.plugin, () -> paramItem.remove(),
theres also a problem with paramitem
Also there is no need to cast (Plugin) this.plugin while using schedules
I think its because of your ide
red = method doesn;t exist
its not red on this on the ide
If something is red because something doesnt exists or is not what the IDE expect
the method doesn't exist
Any fixes?
yes, don't use things which don't exist
if you aren't going to help me don't speak do your own thing
wasnt the answer clear enough?
it isn't helping though, I still can't fix it
Ok
Just create that method
he's trying to call a method in Worldguard but using his own instance, when it's actually static
whatever
any assistance on ParamItem?
What's wrong with paramItem
is anyone aware whats going on?
Exception in thread "main" java.io.FileNotFoundException: /home/kaspian/.local/share/.m2/repository/org/spigotmc/minecraft-server/1.18.2-R0.1-SNAPSHOT/minecraft-server-1.18.2-R0.1-SNAPSHOT-maps-mojang.txt (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileReader.<init>(FileReader.java:75)
at net.md_5.specialsource.JarMapping.loadMappings(JarMapping.java:246)
at net.md_5.specialsource.SpecialSource.main(SpecialSource.java:243)
i've built spigot with remapped arg but still
you might have built for 1.19.2
How do I get the x closest entities to a location?
For example getting the 3 closest entities from a player
Player#getNearbyEntities?
that means I get all the entities not just the 3 closest
Hi a question is possible to make everyone not seeing everyone else like none is in the server but only you?
on server list?
How
On tab
Hypixel does it lol
packets yea
Anyone can do it
Player#hidePlayer over Bukkit.getOnlinePlayers
I got this error: java.lang.NoSuchFieldError: ITEM
with this code: Registry.ITEM.register(ResourceKey.create(Registry.ITEM_REGISTRY, ...
pls help
Hi guys
I'm trying to make an event that happens when you right click a block
however, everytime the player clicks on the block, the event gets executed two times in a row
The method is likely being called on both the server and the client
How can I make so It's only called on the server/client?
the method gets called for start of click and end of click iirc
hmmm
Weird, It doesn't do the same with RIGHT_CLICK_AIR
it fires for each hand
well, when the action is Action.RIGHT_CLICK_AIR, It doesn't 🤔
is this only for Action.RIGHT_CLICK_BLOCK?
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
does anybody know why I get this error: java.lang.NoSuchFieldError: ITEM
with this code: Registry.ITEM.register(ResourceKey.create(Registry.ITEM_REGISTRY, ...
NMS mojang mappings 1.19.2
Don't register new items
you didn;t remap
The client won't be able to understand them
how would i get the UUID associated with a username without them necessarily having joined the server before? id assume something with mojang authlib
java.lang.NoClassDefFoundError: com.mongodb.client.MongoClient i love mongo- hahaha
Am i doing something wrong with PDC? Never used it before
shade it
Its being shade tho
well apparently not
Hmnn
did u look it up before trying to use it?
Yeah
What you mean with that?
oh you wasnt talking to me??
i was not
no, might check the contents of the pdc entry tho
how?
"my epic itemstack".equals(pdc.get(key, PersistentDataType.STRING)) or smth
dunno ifs its nullable
I know that why i have to shade mongo
ohh well it gets stuck at "T" the broadcast message
@civic wind u gotta get the meta and set it after changing the pdc
ohh
That better?
Still stuck at the debug message hmm :/
Mate i have been checking and im shading mongo library into the jar
whats your dependency
mongo-java-driver
And its telling me that its not founding the ConnectionString class but the lib is shaded correctly
Yeah exactly the same
i didnt have to shade it lol
just the dependency
well leaving scope empty shades it automatically ig
Yeah i know that
But didnt fix it tho
Also the most shity thing is that its working yesterday
😡
What?
If you've got a static never-changing item instantiate it once and then just give it to players
if i store a player in a database and in the plugin when the player joins and then load all players into the plugin on start
could it cause memory leaks or something like that
like if there are thousands of players
putting the user in an arraylist of users
You can also lazy-load the data depending on what you need
banning and changing other stats of the player
maybe
when a player does a command
and its not loaded in the plugin
it goes through the database to find the player
but i think that would be worse
dont load all players lol
Again, depending on what you need you should lazy load your data
only load it when needed
Lazy loading is the practice of delaying load or initialization of resources or objects until they're actually needed to improve performance and save system resources.
get ninjad

Yeah i'm not sure how to do that?
When a player joins you give them the good stuff
yes but im using sql and if it has to go through thousands of players its worse
becuase it has to go through all the players in the sql file
It's command based, idk what you mean
wrong person lol
Just make a static final variable and assign it the function call of getItem();
private final UUID uuid;
public UUID getUuid() {
return uuid;
}
public Player getPlayer() {
return Bukkit.getPlayer(uuid);
}
public User(UUID uuid) {
this.uuid = uuid;
}
}``` thats the class thats gonna be stored in a list
At the worst your request would take 100ms. That assumes your db isn't local. Just async load it when the player joins. By the time they've logged in the data should be there.
im gonna add more variables later
This to me or? I'm confused lol
alr
but also
could i keep a different thread
open
No reason to.
Execute a scheduled service if you need to.
and it has to loop through a bunch of blocks
and there could be a lot of arenas
and if i just put runtaskasync
it would run out of cores
so no async
Why would it run out of cores?
Okay? That's not how scheduled threads work
You create a scheduledexecuterservice and make it 1 thread and you can throw everything into it
Then, it will process 1 by 1
if you don't want a delay then executorService
send scheduledexecuterservice tutorial
its the same as bukkits
an Arena shouldnt be aware of its surrounding database
it should be the other way around
why
i just told you, an arena shouldnt be aware of the database
yo is there a way to open a written book gui?
ive searched everywhere but i cant find anything
.
nms
?
?paste
I'm trying to get the selection of a player using WorldEdit API
Why, even creating a selection with the wand, I still get the EmptyClipboardException?
so with this i can open a book gui?
replace spigot-api in the pom.xml to spigot
?bt
search jeff-media using nms
?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.
what exactly does this mean?
sry im very new to spigot
what is build tools?
the thing that builds spigot and gives you full access to allof spigot
what do i have to put inside?
i dont have it
cuz i just converted to maven
add the dep then
That doesn't looks like maven
ik
remove the -api
Fourten
I have find what is happening!!
After 30m checking code and restarting, etc i realize i accidentally uploaded the not shaded jar + all time restarting uploaded the shaded one, but never realize the not shaded was already uploaded
Im defintly a 🤡
:o
Hello anyone using UltraSkywars [ i know its abandoned and its open source ]
iam trying to do a check ,
[Check if the chest is opned , is one of the middle Chests] ..
there is few things in the api for the chests , but i tried few things and didn't work
the code keep running even if i open a island chest
it should only run if its a center chest
not found
and do mvn reload
i was thinking maybe i can check if the player location is near the middle chest [ center chest] , if so the continue the code :
ideas please?
You are better off getting someone else to do it for you, I guess
LocatioN#distanceSquared() is faster than LocatioN#distance()
ItemStack item = new ItemStack(Material.MAP, 1);
MapView view = Bukkit.createMap(itemFrame.getWorld());
for (MapRenderer renderer : view.getRenderers()) {
view.removeRenderer(renderer);
}
TestMapRenderer renderer = new TestMapRenderer();
view.addRenderer(renderer);
MapMeta mapMeta = (MapMeta) item.getItemMeta();
mapMeta.setMapView(view);
item.setItemMeta(mapMeta);
crashes with
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMetaItem cannot be cast to class org.bukkit.inventory.meta.MapMeta (org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMetaItem and org.bukkit.inventory.meta.MapMeta are in unnamed module of loader java.net.URLClassLoader @45fe3ee3)
The item meta is a map meta no?
isnt it FILLED_MAP
have you ran buildtools
is it the same?
how do u do that?
what's the diffrence i mean why its faster
?bt
download the jar and git then run the correct command
https://gitforwindows.org
https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar.
We bring the awesome Git VCS to Windows
distance is just Math.sqrt(distanceSquared(loc))
in a new gitbash in a new folder with buildtools, java -jar BuildTools.jar --rev VERSION
is there a tut on how to do that?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
download git, download the jar
cerate a new folder
drag the buildtools jar into that folder
right click, click open gitbash here
you dont even need git
type java -jar BuildTools.jar --rev 1.major.minor then press enter
thought you did though
BT downloads it's own Git/maven
you learn something new everyday
Indeed
So I ran into an issue: Using a custom map renderer it seems as if when another player block-picks the map I can't see it anymore unless I also select it
why's that?
Also, it seems as if something is still sending a ton of map packets, even though I removed all renderers (including mine)
To update the map I send ClientboundMapItemDataPacket (I am not using a map renderer per se, I call it that), and if you're wondering why I am using packets: In my specific case it's more performant to do so than to use the spigot API, that's it really lol
Hi! How can I block sideways moving of a player who riding a horse?
don't do custom images like this pls
it's too fuckin slow
Hello , is there a better way i can imporve this working code?
its working correctly , but i want to improve it , as i see allot of if statments , and for loops

Let's see...
First things first
Ctrl + Alt + L
It should restructure it
a flaw I notice is that you're doing return; inside for loops
which completely returns the method, instead of skipping the iteration
