#help-development
1 messages · Page 1607 of 1
My projects are on a 7200RPM HDD
regale us with a screenshot nnya
show us what your discord looks like
And it's only there for like a second at most on my bigger projects
whenever the status text updates
it steals window focus
and takes intellij to the front
how small are your projects
30 seconds for 1 file
which means that if I'm try to write here, in discord
while I'm opening a project
even with just 50k lines it's already taking just about under a minute
The one I'm working on atm only has 15 classes
the cancel button is automatically highlighted
and the process of loading the fucking project is cancelled
lol
I dont understand why getLogger is underlined red, do I need to import something into my project to make it work?
lol that has literally never happened to me, didn't even know it could happen
probably because it's only open for like a few seconds at most for you
but stealing window focus is still unforgivable in my books
why the fuck does it do that?
I swear he lives in an alternate hell dimension and all he has for a computer is a rpi
what compels the fucking developer to call some function that puts intellij window in the front when the status message changes?
like what the fuck
why
it's not something that's done accidentally
Very nice
see that's not an issue when you have 5 monitors
Spigot being stupid
someone needs to go out of their god damn way to make it happen
I've never noticed it goes in front of anything
there is nothing for it to be in front of in the first place
i have several monitors, too
but only one window can be focused at once
you know, the one your keyboard input goes towards
for me right now, the ripcord window, with its chatbox
the issue is that my keyboard input is suddenly fucking pipelined to intellij
I need to test this again because I've actually never noticed it hijacks in and now I'm wondering
where it does random things
it may be fixed in the newer versions, I saw quite a bit of outrage about focus issues regarding maven on the support channels
I was pressing a on discord the whole time it loaded
i might update intellij if that is the case
it's super fucking annoying
intellij has a poor track record with window focus
it used to do the same thing whenever you reimported your maven project
but people raged about it and it got fixed
I only use gradle because it’s faster altho it devours my ram like it’s sweet candy
Chrome 2.0
Hmm yeah, also xml is quite counter intuitive to work with once it gets too nested
with 8gb of ram and a relatively fast SSD, i've never run into memory issues on this machine
bruh
everything responds instantly as long as the fucking potato cpu isn't capped out
IJ does not steal window focus for me at all when launching it
minecraft
not on this machine
🤡
Also I believe forge is set to 8gb ram by default 😫
oh no lol
Ah okay
i do sometimes play tanki online on this though
does that laptop have a completely green filter?
bruh
it's a flash game so it's pretty small
Hmm doesn’t it?
it's a russian bootleg of world of tanks
Only thing I play on my pc is minecraft and mine sweeper rn literally, can’t handle anything else
32gb of ram feels good
i can probably barely play minesweeper on this machine
😳
tbh I should probably get more
i tried that one survival game or whatever it is, Forest I think it was called
it was many years ago but iirc I had around 3 fps
But IntelliJ runs fine?
oof lol
Alright fair
between video editing and my shitty blender skills I eat ram for breakfast
also unity
like, I have developed the ability to write entire classes of code without looking at the screen
Sounds like you’re living in full harmony magma
because sometimes intellij just shits bricks for 60+ seconds
and I can't be arsed to wait for it
so I just type shit and let it catch up eventually
🥲 lmao
people say my specs are ridiculously overkill and I keep saying that my hardware gets pushed to 100% on every front on a daily basis
just never for gaming lol
you just don't know how to micromanage
granted I suppose video editing and rendering is pretty resource intensive
streaming is as well
if you want to create a blender model while you have unity open you're going to need a pretty beefy computer
just suspend unity while you're making the model
sure but if you just want to dish out a quick fix to a model you'd be surprised how long unity takes to open a project back up
if you don't close it it's going to passively eat resources
it's not if you suspend it
which is why I said suspend and not close or kill or whatever
if you're tweaking a model you probably want to view the reference you have in the world in unity while you work on it
or maybe that's just me
well then you can't close unity either
yeah
i prefer to scale horizontally
that is, buy more shitty laptops
and pile them on the same table
that way you can run your unity and your model shit completely independently
are they different shades of red?
there's a gray and a blue and a red one
ah yeah rgb
there's also a dark gray fourth one for the desktop
you must be a gamer
my mouse pad is very small
so I've had to increase the mouse sensitivity a bunch
moving the mouse 2cm moves the pointer all the way across my monitors
I will unironically pay you $5 for you to go around filming wherever it is your computers are in, catalog what you have and describe how your setup works and put it up publicly on youtube, because in my mind there is an 85% chance that if there is a window in the shot we will see one of the circles of hell through it
rain is quite rare here
i'm on the coast, but there's some sort of a geographic thing here that makes it never rain
it's rained like 2 days all this year
Are there any examples of making subcommands in multiple classes on the forums?
use a framework like acf if you want a decent solution
Yeah or look into ACF or something like cloud
Okay
i need to rewrite my command framework at some point
could is good but it can not deal with reloads at all which is a shame
cloud command framework
it's good if you want something that will out right out of the box with no modifications
which I did
Only con with cloud imo is that it’s too cumbersome to setup
eeeeh
Like you need to specify the command a manger, mchelp, audience, execution coordinator and so on
it could be simpler
Yeah
the thing that kills me is genuinely the reload thing
Lmao ye
plugman reloads were an incredible shortcut
😌
what is the underlying issue with it not supporting reloads
is it something super irrevocable
or do they just need like a remove call to the commandmap on disable
I fought to get reloads to work for a while but it was pretty baked in from what I remember
cloud has a bit of a dependency tower of pisa which doesn't help
urgh
if (args.length < 2)
OH
i didnt know that was a thing :D
thank u
oh yeah, speaking of a pain in the ass
are there any oss vehicle plugins that aren't totally garbage
I'm not sure such a thing is even feasible tbh
i forked this one vehicle plugin a bit ago and it's slimefun levels of needs-a-rewrite
the smallest amount of ping causes horrendous desyncs
i mean
boats work fine
why can't other vehicles
i don't remember boats having clientside controls
Hello, has anyone ever incountered a bug where if you teleport a player in another world, and then you try to change its gamemode, the gamemode doesnt change ?
cound be wrong I suppose
it is possible to save hashmaps to the server, yes?
or do those get deleted next time the plugin unloads
I think you are wrong but the last time I messed with boats 1.0 had just come out
so who knows
from my little bit of testing I think it should be manageable as long as the vehicle speeds aren't super fast
hashmaps dont save unless you save them to a yml file or database
list*
same with lists
nothing is saved unless you save it
ahhh
i'll google how to do the YML then
cbb to use a database
database are actually super easy ngl
just put, get, some basic functions
easy to pickup
instructions unclear, now listening to YMCA
for basic actions of course
until someone tells you not to do db queries in the playermoveevent
will probably look into that then, thanks
i'm pretty sure I've seen it done at least once
not any more difficult than any other sort of flatfile saving, but probably doesn't have as many tutorials or tools in the spigot region of space as f.e working with yml files
is it less laggy than requesting entire txt files
or yml
etc.
how can I set the display name for a custom tool
get its item meta, change its display name, set the item meta
a file is a file, txt or yml or csv are all the same shit under the hood
ItemStack result = new ItemStack(Material.DIAMOND_AXE, 1);
ItemMeta meta = result.getItemMeta();
this is what I have I just don't know how to set the name i try to use
meta.setDisplayName(ChatColor.RED + "The Enhanced Axe")
but the last line is always underlined
and what does the underline say
red underline means a compile time error; hover over it to see the actual error and what it says
the chat color one says its an unknown class
did you import the class
the setDisplayName says nothing and is a solid red line
yes I important org.bukkit.ChatColor
send a screenshot or something
ill dm it to you because it won't let me send it in here if thats ok
you can upload it somewhere and then link it here, but sure
that isn't valid java
you can't write code in a class
you write code in a method
you need to declare a method and then put the code you've written in the method body
ohhhh
public ItemStack getMeAnItem() {
you can only declare methods, fields, and subclasses in a class
arbitrary code must be in a method body
you probably want to return the result but yes something along those lines
you'll also want to call setItemMeta on the item before returning it
alright thanks
Surround your code in triple back ticks so it formats properly please
There should be an event that triggers when a block was broken indirectly. Like when the bottom of a sugarcane block gets removed and all the other sugarcanes break above it
How can I make my plugin work on older versions? I'm using the 1.17 API and the plugin does not work on servers below 1.17
set the api version to 1.13
thanks!
how can i copy area of blocks to another area?
im trying to build a minigame plugin with color party.
i tried the world edit api but it needed player session or somthing but i need it only from server.
this is where i want it to duplicate to: https://pasteboard.co/Kdv8m9t.png
and this is an example i want to duplicate: https://pasteboard.co/Kdv8Iat.png
Then why not just use worldedit then
If you gonna use worldedit api, chances are you gonna install it anyways too
Unless you wanna shade it into your plugin, then you must as well install worldedit haha
Because no one resets mini games manually?
i build the map and built some floor presents but i want every round to change floor and i have fast async world edit in 1.17.1 but i dont know how to use the api
Are players going to build/destroy anything in-game?
If not, the simplest way is to iterate through the blocks and set their type individually, you don't need any api
and after couple seconds the floor disappear except the color
You have predesigned set of floor mappings right
i got location of two corners of the floor
and locations of the floor presents
presets
yea
and i made this class for this
class Platform {
public Location point1;
public Location point2;
public Platform(Location point1,Location point2){
this.point1 = point1;
this.point2 = point2;
}
public Platform(double x1,double y1,double z1,double x2,double y2,double z2){
this.point1 = new Location(Bukkit.getWorld("RainbowMan"),x1,y1,z1);
this.point2 = new Location(Bukkit.getWorld("RainbowMan"),x2,y2,z2);
}
public List<Platform> getPlatforms(){
List<Platform> platforms = new ArrayList<>();
platforms.add(new Platform(12,79,-3,-2,79,11));
platforms.add(new Platform(12,74,-3,-2,74,11));
platforms.add(new Platform(12,69,-3,-2,69,11));
platforms.add(new Platform(12,64,-3,-2,64,11));
platforms.add(new Platform(-4,74,-3,-17,71,11));
platforms.add(new Platform(-4,69,-3,-17,69,11));
platforms.add(new Platform(-4,64,-3,-17,64,11));
platforms.add(new Platform(-4,74,13,-17,74,27));
platforms.add(new Platform(-4,69,13,-17,69,27));
platforms.add(new Platform(-4,64,13,-17,64,27));
platforms.add(new Platform(12,74,13,-2,74,27));
platforms.add(new Platform(12,69,13,-2,69,27));
platforms.add(new Platform(12,64,13,-2,64,27));
platforms.add(new Platform(12,69,29,-2,69,43));
platforms.add(new Platform(12,69,29,-2,64,43));
platforms.add(new Platform(-17,64,29,-4,64,43));
platforms.add(new Platform(-17,69,29,-4,64,43));
return platforms;
}
public Platform getRandomPlatform(){
return getPlatforms().get(new Random().nextInt(getPlatforms().size()));
}
}```
what the hell
what
HARD CODING
its just looking at chords
Before commenting on the code, i dont think you need worldedit api either way
Here
and the floor presets are rotated like 90 degrees
and i need to match it
private Location getLocation1(){
return new Location(Bukkit.getWorld("BlockParty"),26 ,63, -21);
}
private Location getLocation2(){
return new Location(Bukkit.getWorld("BlockParty"),12 ,63, -35);
}```
this is the main floor positions
I cant and shouldnt help you code it, but you mention that every round the colors on the floor rotate 90 degrees?
use a file
to store those
then read it from the file
Hello,
! I made a custom recipe with prepareItemCraftEvent with custom itemstack with custom amount, but when I craft item with 2x+ item matrix, the matrix doesn't remove.;
I tried to clear inventory, but it occurs many erros (in my case.). how can I solve this?
I followed https://www.youtube.com/watch?v=Q2KYeinuoME&feature=emb_title
Hello everybody! Today I will show you da wea of using ItemStacks inside of your crafting recipes! Don't forget to leave a like if you enjoyed :)
Full playlist: https://www.youtube.com/playlist?list=PL_MDptw3Zft_Xb8-i0WBGtwdUN14TMJ...
Version?
1.15.2 - fork by myself
RecipeChoice.ExactChoice
what do you mean?
Also, I use PrepareCraftEvent
not recipe choice
Why
because custom amount
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 copied thijs code
I mean you’ll have to manually remove the items then
I can't 😭
because I made a recipe book
(view player the recipe)
and when I clear, I can't craft
What
thanks you for helping
but
CraftItemEvent doesn't detect for custom craft
but I think I can do it with inventory click event
what are you trying to achieve lol
isn't there a Bukkit.addRecipe or sth
why listen to prepareitemcraftevent? set recipe result's amount doesn't work?
I think they want the ingredient to be stacked
like two sets of ingredient gets two times the amount of result?
then can the result go beyond the maxstacksize or sth lol
ah ok
then yea, you will need both craftitemevent and prepareitemcraftevent
don't quite understand his issue atm
PDC, PersistentDataContainer?
?pdc
Sorry i just dont understand how it works :/
Even with the simple map. idk how to get and add havent really gotten into maps
JUust asking if you could explain it so ik how it works
?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.
I just accidentally did the most pretentious thing of my life
I was wondering which day exactly my father's bday was in so I went and googled him expecting google to straight up give me an exact date, and it did
man universities just doxx the shit out of people huh
was wondering if PlayerBedEnterEvent is deprecated?
doesnt seem to work..?
idrk
"This event is fired when the player is almost about to enter the bed."
so
wait what
so like
i should check its status
ídk what even to use when a player actually enters a bed
also wdym its not working
how do you know?
well thats the thing, i just thought it was if the player started sleeping in a bed
so i had it broadcast smt
tf are you making a 1000 tasks?
no lmao
the time is > 1000
having 50 added to it a bunch,
until its not 100
1000*
stil isnt calling though
but thats still alot
fair, i could definitely increase the amount of time it goes up
or just set it
that isnt the point right now though, i cant seem to get the event to function
why do you even need that much?
⬆️
try using the player interact event and check if you rightclicked the bed
ok but that'd trigger if they clicked the bed in any way
@lost matrix i understand how to get the value now but idk how to add anything
#put(K key, V value)
Will it just add? like if theres already one with the key "strength" or smthing
does it add to the number?
I really should've learned ctrl-shift-+ and ctrl-shift- - earlier on itellij...
What does that do?
increase font size?
expand and minimize everything
oh
useful for when you start hitting 1k lines in a single class or more
it is not "add", map is a different concept
I always manually minimize 😅
no but he made something for me
Good to know lmao
if there is an existing mapping for the key, then the value will be replaced with the new map
4 classes
ain't you asking how to "add" into a Map<K, V>?
No
alr
im trying to recreate my stats system
cus i use persistent data containers rn
but i have to check ALOT of things when i wanna add/remove from the stat if i like equip an item
with armor its eas
y
but with items ill have to check so many events
So im trying to remake it with Custom attribute modifiers
i don't quite understand what you are trying to achieve as a whole
but if you are trying to update the value of a key's mapping
Alr lemme explain
you can use #merge(K, V, BiFunction) instead
I have a GP class (Gameplayer)
Which has some stats rn
Example Strength
I have items with persistent data containers
which contains a key with an amount of the stat
and when i equip armor it will add stats
No i cant bc the classes 7smile7 send me have only private final maps
But those states should not be coded as fields. Rather use a Map to have a more dynamic data structure.
final maps can be mutated
Thats called encapsulation. You need to write methods that change the maps content and are accessible from other classes.
No but i just dont understand how the classes 7smile7 send me work
I thought you just dun understand how to add the stats up under a certain key
i dont understand how to add a custom attribute to an item
Its just a mock up. You can do it with a simple Map<> instead of having all this object orientation if you dont grasp it at the moment.
I should do some more simple stuff first
then learn how maps work
i dont know that much about coding just a bit
Probably. As stated: Properly writing a robust attribute system can be tricky.
ye
ik
Disabling collisions with entities is also kinda hard i noticed
If you want to learn how to use maps i would recommend you to write a simple home plugin.
It will help you learn maps and how to save data between restarts.
a like a map with <String, Location> ?
i save data between restarts with a config file rn
Per player too
per player isnt that hard
i can use a GP class
and save the maps under the UUID of the player
Kind of. But a player should always be represented by his UUID.
So a Map<UUID, Location>
If you only want one home that is
o no i ment like String as in home name if u want multiple
ye
ill try 1 home first
also if id make multiple homes it would be a Map array right?
is that a thing?
HashSet would be good enough
Im confused there are
Maps
HashSet
HashMap?????
Sets are pretty much just maps except they don't allow duplicate entries
ahhh
Hashmap is just an implementation of map so yea
so hasmap is the same as map?
yeah
but you can't instantiate a Map
ahhh
in what version should i make like the practice plugins?>
practice plugins?
.
oh just go with the newest version then I guess
1.17?
i normally use 1.16.5 but alr ig
sure that works
You can simply create an interface called Home and have it require both a name and a location
Also
sometimes my intellij
just doesnt work
like i cant press File
any fixes for that?
rn the only fix i got is restarting pc
Never had this problem, sorry
Personally I'd just go with a HashMap with the UUID as the key and a hashset of homes as the value
huh
So smthing like:
HashMap<UUID, Location> homes;
homes.put(Player.getUniqueID(), Player.getLocation())
?
@quaint mantle
Yes
No
Because if you decide to store the location you won't have the ability to save it with a custom name
Oops i didnt read the previous message
ooo
HashMap<String, HashSet<Home>> test = new HashMap<>();
so HashMap<UUID, HastSet> homes
ahh
But you still have to create the Home class
and that would be an enum?
No, you'd just create a new instance of the home. I'll type up a quick example
public class Home {
public final String name;
public final Location location;
public Home(String name, Location location){
this.name = name;
this.location = location;
}
}```
that'll do
ahhhhh
On the ./sethome command you can simply have it require an argument
ye
alr
then you do Home newHome = new Home(arg, p.getLocation()); which you then add to their hashmap
ye alr
If you don't want homes to have a name you can also just use locations, that's fine too
ye k
String is uuid right?
Oh yeah, my bad
Just replace String with UUID
Someone know how to remove all possible way to get a specific enchant ? (i wanna remove protection 4 possible enchant, fusion etc)
@quaint mantle i have this
public HashMap<UUID, HashSet<Home>> homes = new HashMap<>();
in my GP class rn
is that right?
SetMultimap tho
Oh then maybe not so great of an idea
bad java is what that is
😕
it no work :(
alos @quaint mantle
also*
The GP class
is for each player
so i can make the homes Map<String(name) , Location>
then you really don't need to have the hashmap with their uuid
bc else ill save the uuid twice
ye exactly
hey, does anyone know how i can hide the potion effects particles ? as well as the little icon that says i have this effect
I don't think you can hide the icon
but I believe passing a boolean to the effect removes the particles
map.put(blah, new HashSet<>(Arrays.asList(new Home()))); maybe?
then the home class is also not needed
The home class just holds both the name and the destination
already came to the conclusion that i dont need the uuid xD
Alr
ye but i wanna check if the name already exists
You can simply give the GP class a hashset with homes
^^^^
Yeah
so just go through their homes and check if it's in there
not that difficult
o u can do that
cool lemme test
Well haven’t read the entire convo
Well it'd be set here yeah
Just use Set#contains
Most sets use an underlying Map anyways btw
How do i can put money in my crates
Plug-in= goldencrates
They are lists, no?
Sets aren’t lists
They don't have values
just keys
gp.homes.forEach(home -> {
if(home.name.equalsIgnoreCase(name)) {
return;
}
});
Yeah but check something like HashSet for instance
this should work right?
It uses a backing HashMap<E,Boolean> iirc
return;
}```
oh lol
I'd recommend at least sending the player a message btw xD
then i get this
ye ik
What is homes in your GP variable
How do i can put money in my crates. (Vault money)
public HashSet<Home> homes = new HashSet<>();
You might have to do the forEach because homes is a home object
ye im doing mine xD
or a regular for ofcourse, might look better
But then you still can't compare it that way
it'd be home.name, not home
Can someone help me how to put money in my crates (Vault plug-in money)
No
Oh oké
yeah, this is where the competent people hang out
😎
return was giving me a warning so i did this
AtomicBoolean homeExists = new AtomicBoolean(false);
gp.homes.forEach(home -> {
if(home.name.equalsIgnoreCase(name)) {
p.sendMessage(C.C("&cA home with that name already exists!"));
homeExists.set(true);
}
});
if(!homeExists.get()) {
Home newHome = new Home(name, p.getLocation());
gp.homes.add(newHome);
p.sendMessage(C.C("&aSet a new home called: '&e" + name + "&a'"));
}
God that's awful
ye ik
Use a normal loop, get rid of that dumb atomicboolean
return was giving me a warning for some reason
You can't return in a foreach
Idk if that even would work might give you a ConcurrentModificationException
done
for (Home home : gp.homes) {
if (home.name.equalsIgnoreCase(name)) {
p.sendMessage(C.C("&cA home with that name already exists!"));
return true;
}
}
That's more like it
aaaah dammit
i made the project in 1.17
forgot to change the version
now im getting erros
errors
lol
Are you using something like maven or gradle?
maven
You change the version in pom.xml
Yeah and then reload maven project
done
That should be it
lmao yeah
You’re enforcing your plugin to run on 1.17 or else it will shout
So I assume you don’t actually run a 1.17 server
ye
i forgot to change the plugin.yml to 1.16
is there even any differences in the api
idk prob not
oops forgot the /home command
@quaint mantle
i made the /home command
is this right?
String name;
if(args.length == 0) {
name = "Home";
} else {
name = args[0];
}
Home homeToUse;
for(Home home : gp.homes) {
if(home.name.equalsIgnoreCase(name)) {
homeToUse = home;
p.sendMessage(C.C("&aTeleporting to home: '&e" + name + "&a'"));
p.teleport(homeToUse.location);
} else {
p.sendMessage(C.C("&cCouldn't find a home with that name!"));
}
}
i wanted to create a boolean again called foundHome
and if it dit
did*
it got that home and teleported to it
if not
other stuff
yeah looks good I guesss
You can shrink that code down to a couple lines
no need to make homeToUse
ehh true
just return after teleporting the user
false or true
If gp.homes is a arraylist why not do . contains on it?
for (Home home : gp.homes) {
if (home.name.equalsIgnoreCase(name)) {
p.sendMessage(C.C("&aTeleporting to home: '&e" + name + "&a'"));
p.teleport(homeToUse.location);
return;
}
}
p.sendMessage(C.C("&cCouldn't find a home with that name!"));```
bc its not an arraylist
its a HashSet
ahhh
You'd be comparing a string to a Home object, can't do that
he's iterating over Homes
I'd also limit the amount of homes a player can set, wouldn't want some dude to create a billion homes @quaint mantle
1 problem
on playerJoin
i load the players stuff from the config
but i get that
pl = FileConfiguration
it’s just get() then
Yeah well you need to convert that into a HashSet
Cast it?
public class Home {
public final String name;
public final Location location;
public Home(String name, Location loc) {
this.name = name;
this.location = loc;
}
}
Alright and how does the config look?
.
public class Settings {
private static final FileConfiguration pl = registers.pl.getConfig();
public static void DestroyGP(GP gp) {
String a = "players." + gp.getPlayer().getUniqueId() + ".";
pl.set(a+"homes", gp.homes);
gp.DestroyTimers();
gp.Destroy();
}
public static void LoadGP(GP gp) {
String a = "players." + gp.getPlayer().getUniqueId() + ".";
gp.homes = pl.get(a+"homes");
}
}
OH
Wouldn't it be fine if you cast it as long as you know thats it is a hashset full of home?
1 sec
thing is, get(path) never returns a HashSet
for example
this
players:
295c1422-92a6-4f5d-bd4b-690c3dfb6b70:
homes: !!set
? !!quac.practice.Home
location:
==: org.bukkit.Location
world: world
x: -79.57724830341647
y: 64.0
z: -85.09642026727794
pitch: 33.299957
yaw: -89.099434
name: how
: null
? !!quac.practice.Home
location:
==: org.bukkit.Location
world: world
x: -84.93796836288155
y: 64.0
z: -85.12178193048537
pitch: 33.299957
yaw: -89.099434
name: hi
: null
? !!quac.practice.Home
location:
==: org.bukkit.Location
world: world
x: -74.46921524648975
y: 64.0
z: -85.07537722526311
pitch: 33.299957
yaw: -89.099434
name: are
: null
? !!quac.practice.Home
location:
==: org.bukkit.Location
world: world
x: -68.78277553498273
y: 64.0
z: -85.05154698815029
pitch: 33.299957
yaw: -89.099434
name: you?
: null
Uh okay
Maybe it’s possible to cast it ¯_(ツ)_/¯
Probably have to deserialize that but who knows
this tho
A warning
Yeah that’s cause of generics
do i ignore that?
Mostly you could ignore tho but you just make sure you actually have a HashSet<Home> in the config
Make Home implement ConfigurationSerializable
Would that do anything?
Not on its own
and then?
@Override
public @NotNull Map<String, Object> serialize() {
return null;
}
wat i put there
Btw is your home class Exist in quac.practice?
ye its there
Map<String,Object> map = new HashMap<>();
map.put("name",name);
map.put("location",location.serialize());
return map;
Or smtng
Then you need to add a second method
where
public static Home deserialize(Map<String,Object> map) {
String name = (String) map.get("name");
Location location = Location.deserialize(Map<String,Object> map.get("location"));
return new Home(name,location);
}
That into ur Home class also
Then also add
static {
ConfigurationSerialization.registerClass(Home.class);
}
Oh yeah wrap that with ()
wat
(Map<K,V>) map.get(....)
Isn't there a tomap method
.
Like a method
where
Above the constructor
alr
public class Home implements ConfigurationSerializable {
public final String name;
public final Location location;
static {
ConfigurationSerialization.registerClass(Home.class);
}
public Home(String name, Location loc) {
this.name = name;
this.location = loc;
}
public static Home deserialize(Map<String,Object> map) {
String name = (String) map.get("name");
Location location = Location.deserialize((Map<String,Object>) map.get("location"));
return new Home(name,location);
}
@Override
public @NotNull Map<String, Object> serialize() {
Map<String,Object> map = new HashMap<>();
map.put("name",name);
map.put("location",location.serialize());
return map;
}
this?
Uh sure
Try again, remove all existing homes
I see this
Yeah idkidk but that’s slightly slower than what we did above and Idk if this guy is ready for higher order functions
It's cuz your iterating over null
this line
homes is null then
I just found this idk wtf it means much really either lol
¯_(ツ)_/¯
Yeah
Pjoens might wanna restart the server and try everything again
nope still this
alr i stopped server deleted config
then started it
same error :/
Yeah well send the relevant code
String name;
if(args.length == 0) {
name = "Home";
} else {
name = args[0];
}
if(gp.homes != null) {
for (Home home : gp.homes) {
if (home.name.equalsIgnoreCase(name)) {
p.sendMessage(C.C("&cA home with that name already exists!"));
return true;
}
}
}
Home newHome = new Home(name, p.getLocation());
gp.homes.add(newHome);
p.sendMessage(C.C("&aSet a new home called: '&e" + name + "&a'"));
return false;
entire command
gp.homes.add(newHome)
is line 41
Where do you set gp.homes
Send entire stacktrace also
in the GP class
public HashSet<Home> homes = new HashSet<>();
Hmm do you set it any where else
Yeah you do
public static void LoadGP(GP gp) {
String a = "players." + gp.getPlayer().getUniqueId() + ".";
gp.homes = (HashSet<Home>) pl.get(a+"homes");
}
1.9.4 is the version you want probably
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.9.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
i managed to get the spigot-api to work
but now it wants the craftbukkit
how would i fix it then
And then override with a spigot one
the thing is it depends on shit like:
import net.minecraft.server.v1_9_R1.IChatBaseComponent;
i guess i could delete them 🤔
Pjoens of the player has no homes then that pl.get() returns null
Well
You’d run bt then?
yeah i ran 1.9 bt
no but the error is when i SET a home
didn't seem to add shit to m2 tho
that loadGP only runs after reload or when i join the server
Sounds odd
But the issue is when the player joins
i am just deleting classes at this point
do smtng like
home.gp.clear();
HashSet<Home> homes = pl.get(...);
if (homes != null) {
home.gp.addAll(homes);
}
Ye ty
🤨
pathfinding
but the only lib i could find was this shit one from like 2018
Hmm I mean shouldn’t mappings help enough?
😌
it uses the A* algo
Ah nice
was gonna have to write it myself so am trying it first
Alrighty
is there a constructor?
Believe not, going from Loc to V3d works not the other way around
Since Loc has more data than v3d
ok
Bukkit Vector has a toLocation method
Assuming it takes a world then?
one takes a world, other takes world, pitch and yaw
Yea then it’s an impure conversion
shit
java.lang.NoSuchMethodError: 'int org.bukkit.block.Block.getTypeId()'
too old i guess

welp - thats an hour gone
Sounds like me frankly lol
the one time a method gets removed is the time that i need it
🥲
ElgarL's pathfinder did work, but it didn't really work around corners
was trying to find an A* implementation
I mean new Location(world,x,y,z)?
pitch & yaw
No, it would be a pure conversion if you could from a vec3d convert it to a location without having to take any additional data from outside.
?
?
Why was PacketPlayeOutTitle removed in 1.17?
You sure it was?
https://github.com/Attano/Spigot-1.8 I found this lol how hasn't it been taken down yet
How to set a !permission.perm to a player ?
to set a negation did i need to unset a permission or set false a perm ?
Yeah i don't see it anywhere. I just used the api call player.sendTitle()
while(e.getRightClicked().getPersistentDataContainer().get(key, PersistentDataType.STRING).equals("handcuffed")){
Location currentLocation = e.getPlayer().getLocation();
Vector Direction = e.getPlayer().getLocation().getDirection();
Direction.multiply(1);
Location target = currentLocation.add(Direction);
e.getRightClicked().teleport(target);
}```
do you guys think
this is a good way of doing it
i want the player to continuously get teleported 1 block ahead of a player
player.getLocation().add(0, 1, 0);
yeah direction.multiply(1) is like doing 5 * 1, 150 * 1, 80 * 1 (for each of the coords) and does nothing lol
also agleer, that would be the Y coordinate, teleporting them up one
Isn't that 2Hex wants?
they say "1 block ahead"
I don't think so
I would say they want add(1, 0, 0) and add(0, 0, 1) or add(-1, 0, 0 and add(0, 0, 1) depending on the direction.
tip- you can specify defaults when you are accessing the config for values
e.g. config.getString("path", "This text will be used if the path does not exist in the config.")
what you sent me is not what I want lol
oops
ah my bad
yeah forgot to copy the path
I thought about using XYZ but
it would change depending on the direction so i just multiplied
oh
multiply isnt gonna get you far
yeah
because nobody gives a shit and the dmca was stupid in the first place
yes, but that would still have to be based on where the player is looking
if the player is going south
and you do add(1, 0, 0)
no
theyll go in the exact opposite direction
while(e.getRightClicked().getPersistentDataContainer().get(key, PersistentDataType.STRING).equals("handcuffed")){
Location currentLocation = e.getPlayer().getLocation();
Vector Direction = e.getPlayer().getLocation().getDirection();
Direction.add(1);
Location target = currentLocation.add(Direction);
e.getRightClicked().teleport(target);
}```
so
is that what u mean
no
you can try it out
its gonna move the other handcuffed player
but if you see what happens you might understand easier what I mean?
Nevermind
add won't work anyways
ok i think
Location currentLocation = e.getPlayer().getLocation();
Vector Direction = e.getPlayer().getLocation().getDirection();
Location target = currentLocation.add(Direction);
e.getRightClicked().teleport(target);
will do it
tfw you spend a while rewriting a system only to realize as you're finalizing it that it fundamentally will not work
man and I had such a clean implementation too
Most people don’t use vscode for java
Eclipse/ IntelliJ are more commonly used
^^
Dont think my laptop can run more than a text editor
vscode is a bit more than a text editor lol
but if you want to stick to it, theres a "Java Extension pack" which helps a little
Still, IDEA or Eclipse are muuuuuuuuch better
if im unhappy with this approach ill try IDEA
man I am not happy that my cool new implementation won't work
hey
is there a way for a condition to recognize a taskid in another condition, like in this code ?
if(clicked.hasPotionEffect(PotionEffectType.SLOW) && clicked.hasPotionEffect(PotionEffectType.BLINDNESS)) {
System.out.println("if");
player.sendMessage("demenoté");
player.getActivePotionEffects().clear();
Bukkit.getScheduler().cancelTask(taskid); //here problem
}
else {
System.out.println("else");
player.sendMessage("§6§l[GCA] §f§aVous avez menotté " + clicked.getName());
clicked.sendMessage("§6§l[GCA] §f§cVous avez été menotté par " + player.getName());
clicked.addPotionEffect(slowness);
clicked.addPotionEffect(blindness);
int taskid = Bukkit.getScheduler().scheduleSyncRepeatingTask(Bukkit.getServer().getPluginManager().getPlugin("GCAPlugin"), new Runnable() {
@Override
public void run() {
Location player = new Location(e.getPlayer().getWorld(), e.getPlayer().getLocation().getX(), e.getPlayer().getLocation().getY(), e.getPlayer().getLocation().getZ(), e.getPlayer().getLocation().getYaw(), e.getPlayer().getLocation().getPitch());
clicked.teleport(player);
}
}, 0 * 20, 1 * 20);
Bukkit.getScheduler().runTaskLater(Bukkit.getServer().getPluginManager().getPlugin("GCAPlugin"), new Runnable() {
@Override
public void run() {
Bukkit.getScheduler().cancelTask(taskid);
}
}, 20 * 30);
}```
?paste
it tells you @grim ice
on use.java line 53
i mean its an npe
can yousend code
ill check it 1s
Simple stuff, NPE means theres null somewhere where there shouldnt
line 84
It still tells you what your issue is.
1s
onUse.java line 53 and 84 are errors
learn java
Track that line down and make sure youre not calling on null values
if(!e.getRightClicked().getPersistentDataContainer().get(key, PersistentDataType.STRING).equals("handcuffed")) {
thats line 53
do
which will result in a NPE in the subsequent equals call
I don't understand what you're trying to do. The task with taskid only exists in that other condition. Or do you want to cancel that task later when the player does something else? Then store taskid in some class field so you can access it later.
yeah this is it
If it's per-player just add a HashMap<UUID, int> or sth and save the taskid using that and use that id to then cancel it
Easy
wat
Operator '!' cannot be applied to 'null'
learn java
if its NOT null
just making sure
clearly you don't
Quick question, when compiling a plugin, what's the difference between the jar and the master jar?
if(e.getRightClicked != null && !e.getRightClicked().getPersistentDataContainer().get(key, PersistentDataType.STRING).equals("handcuffed")) {
get is nullable
it may return null
which will result in a NPE in the subsequent equals call
i had the same error
but
borats answer is better
only, it was with my item
how do you safely remove a bossbar? does #removeAll() make it so it can be caught and deleted by the java trash compactor?
what does happen when you call getPdc on an air itemstack
