#help-development
1 messages · Page 2008 of 1
doesn't every hoster have at least one mysql DB free?
Most hosts do
wait..
its not host specific
how does mysql work?
if u buy minecraft hosting u get free databases most of the time
What do you mean how does it work
you start the server and then connect to it? lol
oh great mongo shat itself again
ok then i have a free database
i own a server lol
Problem: using mongo
Solution: don’t use mongo
i use it for luckperms
seems like wrong port or sth like that
nah its just that clevercloud sucks for mongo
but i dont have a node for databases yet
Clever cloud, dumb ground
i dont rlly have another option lol
ironic that "Skygamez" is using "Clever cloud"
its that or i buy a server for mongo
It supports literally everything
Yes :3
:D
vps costs money
idk
Gordon Ramsey in basically every Kitchen Nightmares:
IT'S FOCKIN' RAAAW
i need to keep costs low for the development phase of the server
they're both orange
Is your last name Trump or smthn?
mainly cause i need to save money for buying plugins and other shit for the server
Was I Donald Trump all along
Step 1. Use the database your server probably provided
Step 2: don’t buy premium plugins
They suck
<3
This is true
not just plugins
i need builds, graphic design, web design, all that
all that costs
wait for it
money
You making the next hypixel
...
this is just basic stuff
if i just put a dirt build on the server and released it
actually that could be cool
but not rn bad impression
Have you considered armed robbery as a source of income
^
LMFAO
Hasn't failed me yet
i made it in 10 seconds using mspaint
the grandchild trick is the best way to get $$$
like legitimately some of the best graphic design I've ever seen
gg
I think you win at life
slight problem with that
this server is currently being hosted 24/7
my computer is not up 24/7
Okay
more like 15/7
So host it on the server
Then
mongo tho
Setup luckperms to use sql
i probably should do that
but i dont rlly feel like transferring perms at the moment considering i was doing over an hours worth of debugging on a plugin all for it to be a little invisible typo on plugin.yml
I bet lp has something to handle the transfer for you
it does
but i have to reopen minecraft and export the perms then setup a new database on all the subservers and proxy then reload the perms
tedious
You don't need to open minecraft for it. Just use the console command. 😛 (lp export <fileName>)
its 10 grand to use MySQL publically?
oh im sorry thats the expensive pack
2 grand
jesus fuck
what?
maybe if you want to use the enterprise version
which includes support and other tools
the community edition is free
does that mean i can store data
easy
or
the only difference between the enterprise and community edition is the tools and support for enterprise. Otherwise functionality wise with the DB software is the exact same
probably should have better researched their site
because their site actually states this
i saw 10 thousand dollars
and got scared
who wouldnt get scared at the site of that
thats INSANE
If you didn't bother looking at any other pages sure I guess
they don't make it hidden for the community edition
doesnt getType return name and such?
block.getType() == Material.CHEST
This wouldnt work normally...
would it?
Cancel the interact event
if(blockCont.get(new NamespacedKey(EmeraldsPlugin.jp,"crateMain"), PersistentDataType.STRING) == null){
blockCont.set(new NamespacedKey(EmeraldsPlugin.jp,"crateMain"), PersistentDataType.STRING, "basicCrate");
p.sendMessage(ChatColor.GREEN + "Crate is now a basic crate!");
Any reason why this, when clicking twice, runs successfully still?
It should be detecting it as not null anymre
What is blockCont
TileState state = (TileState) block.getState();
PersistentDataContainer blockCont = state.getPersistentDataContainer();
yes btw its a chest
Do you update it
wdym update it
state.update
ty
@young knoll Last question: How would I prevent somebody from closing a gui for X amount of time?
Whats the event name?
InventoryCloseEvent
nvm not going to use that, how do I check if its closed?
Player.getOpenInventory
p.getOpenInventory() == null
does it return null if its closed
or
It returns the players inventory if its closed
how would i check if its actually closed
p.getOpenInventory().equals(gui)?
this is gui btw: Inventory gui = Bukkit.createInventory(p, 9*5, crateType);
sorry if im asking so many questions btw lol
item flags
which flag?
ItemStack item = new ItemStack(Material.DIAMOND_SWORD, 1);
ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
item.setItemMeta(meta);
ah thanks
What version is this
1.18.1
Why a hoe
so i can have custom textures
Use something edible, it will make life much easier
for each damage value
@young knoll Small question: How do i constantly update and open a gui
like an animation
with a hoe you can have like 3000 custom textures on one item though
ig you could say
wait what
Just edit/replace the items in the GUI
how
so just constantly do gui.setContents?
You can set a single item
no one uses those
oh
Using something already edible will give you the nice animation
i guess so
And then you can just intercept the PlayerConsumeItemEvent
i can use like a water bottle then right
Sure
i'm trying to make the alcohol have a certain ml of liquid in it
so you'll be able to drink it like 20 times before it disappears
thing is that means i'm gonna have to have a custom model for empty bottles and water bottles
for that split second when the bottle is empty before the server replaces with a water bottle
?
like
i can have an event
when the player consumes the water bottle
it'll replace the item in their hand with a new one
Why replace it
what else can i do
because when the water bottle is consumed it turns into a glass bottle
oh forgot about that
@young knoll How would I select a random object in a list like so?
Crates:
basicCrate:
fullName: Basic Crate
itemList:
DIAMOND:
Type: Regular
Amount: 5
EMERALD:
Type: Regular
Amount: 5
NETHERITE_INGOT:
Type: Regular
Amount: 1
Each have equal chances btw
You can read the keys of itemList into a collection
And then get a random element from the collection
Can you show me an example?
Cant find anything online.
private static Object getRandom(String crateType){
Object conf = EmeraldsPlugin.jp.getConfig().get("Crates." + crateType + ".itemList");
Object item = null;
return item;
}
if i were to use meta#getCustomModelData on an item that doesn't have a custom model data set, what would it return?
getConfigurationSection(Crates.basicCrate.itemList).getKeys(false)
“Plugins should check that hasCustomModelData() returns true before calling this method.”
So who knows, might throw an error
Wont that get only the first one?
oh i didnt know thats a thing
thanks
getKeys gets all the keys
Ah okay
@young knoll Last question, is there a way I can get an enum based on a string?
Example: Material[item]
or smth like that
Material.matchMaterial
@young knoll returns null
private static ItemStack getRandom(String crateType){
FileConfiguration conf = EmeraldsPlugin.jp.getConfig();
ItemStack item = new ItemStack(Objects.requireNonNull(Material.matchMaterial(conf.getConfigurationSection("Crates.basicCrate.itemList").getName())), 1);;
return item;
}
printed in console as a test first btw
And?
You are getting the name of the section
Yes?
DIAMOND:
Type: Regular
Amount: 5
EMERALD:
Type: Regular
Amount: 5
NETHERITE_INGOT:
Type: Regular
Amount: 1
The name of the itemList section
As in its returning DIAMOND
Is itemList
Crates.basicCrate.itemList.DIAMOND
yea but
That’s why I told you to read all the keys into a collection
OH
So you’ll have a list of DIAMOND, EMERALD, etc
yes but how lol
is this basically a hashmap computeIfPresent but with a put after it? I tried computeIfPresent but couldn't return
HashMap<Integer, Integer> hm = ...
if(hm.containsKey(target-n)) {
return new int[]{hm.get(target-n), i};
} else {
hm.put(n, i);
}```
Or just get the value once and check if it’s null
@young knoll it errors, now at randomSelection
FileConfiguration conf = EmeraldsPlugin.jp.getConfig();
Set<String> list = conf.getConfigurationSection("Crates.basicCrate.itemList").getKeys(true);
int size = list.size();
int randomSelection = new Random().nextInt(size);
int i = 0;
for(String obj : list){
if (i == randomSelection) {
return new ItemStack(Material.getMaterial(obj), 1);
}
i++;
}
Caused by: java.lang.IllegalArgumentException: bound must be positive
11.03 04:33:59 [Server] INFO at hidingthis.Crate.getRandom(Crate.java:21) ~[?:?]
the code works, it was an O(n) solution to something I'm working on but I was wondering something that doesn't really matter ig
You know you can just do
List.get(random number)
Well, if you use a list instead of a set
so i've tried to use a resource pack to edit the potion's texture and decided to use a gold ingot as a test...
I've just created pink bar.
Pig ingot
“Errors” does not help
size is < 0
but why
Required type:
List
Provided:
Set
<java.lang.String>
Unfixable
bound is size in nextInt(size)
Oh weird it returns a set and not a collection
You can just do list blah = new ArrayList(get the stuff here)
is there a way to make a potion "colorless"? Because I think thats what is making my textures pink
confused on what you mean
also @young knoll still no workie
FileConfiguration conf = EmeraldsPlugin.jp.getConfig();
ArrayList<String> list = new ArrayList<String>();
list.addAll(conf.getConfigurationSection("Crates.basicCrate.itemList").getKeys(false));
System.out.println(list);
return new ItemStack(Material.getMaterial(list.get(new Random().nextInt(list.size()))), 1);
I did what you said
Its at return it doesnt work
I can't seem to find the correct api to make a wolf that I spawned via a item become tamed by the item owner if someone can help guide me to the correct api I would appreciate it!
Tamable#setOwner
Doesn’t work isn’t helpful
11.03 04:47:15 [Server] INFO Caused by: java.lang.IllegalArgumentException: bound must be positive
11.03 04:47:15 [Server] INFO at java.util.Random.nextInt(Random.java:322) ~[?:?]
11.03 04:47:15 [Server] INFO at me.emerald.emeraldsplugin.ui.Crate.getRandom(Crate.java:25) ~[?:?]
Error
also, list prints out []
That means the list is empty
Well, why?
Crates:
basicCrate:
fullName: Basic Crate
itemList:
DIAMOND:
Type: Regular
Amount: 5
EMERALD:
Type: Regular
Amount: 5
NETHERITE_INGOT:
Type: Regular
Amount: 1
Did I do something wron here maybe?
Looks fine
Here is an updated thingy @young knoll
private static ItemStack getRandom(String crateType){
FileConfiguration conf = EmeraldsPlugin.jp.getConfig();
ArrayList<String> list = new ArrayList<String>();
list.addAll(conf.getConfigurationSection("Crates." + crateType + ".itemList").getKeys(false));
System.out.println(conf.getConfigurationSection("Crates." + crateType + ".itemList").getKeys(false));
return new ItemStack(Material.getMaterial(list.get(new Random().nextInt(list.size()))), 1);
}
It errors at new Random().nextInt(list.size())
for some reason
Yeah then list is empty
Yea its returning empty
tested list.size
why?
yea cause it error at list.addAll
cause it be unable to find the correctpath
That's kind of a bad way to do it
It'll refetch every time
Doing an O(n) operation just to fetch one element which should be O(1)
Just load it once and then get a random element when the method is called
How am I suppost to load it once?
Do it on startup
public class Crate {
private static ItemStack getRandom(String crateType){
ArrayList<String> list = new ArrayList<String>();
list.addAll(EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates." + crateType + ".itemList").getKeys(true));
System.out.println(list);
System.out.println(EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates." + crateType + ".itemList"));
System.out.println(EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates." + crateType + ".itemList").getKeys(true));
return new ItemStack(Material.getMaterial(list.get(new Random().nextInt(list.size()))), 1);
}
Just load it and store it somewhere rather than refetching every time
Oh.
That system also doesn't allow for any kind of weighting other than by adding duplicates
What if i need to add some sort of wait or smth for it to addAll?
But im not sure, my brain hurts e.e
You do not
Any way to do my script better then?
Several but it would probably just be confusing to spew them all at you
would it be bad for me to say wow me
Everyone starts somewhere
I would learn more java before tackling spigot, but I can’t really tell you what to do
its how i learn
i tackle hard stuff so that i challenge myself, but ask for help
i learn more in a shorter time, and recall it better
- you cant "learn" java without a reason to
so trying to make a minecraft plugins a good way to actually learn java
per say
Disagree
Spigot is a third party API, you don’t need to be introducing it until you understand enough of the first party APIs
True, but as I said its how I personally learn
Personal preference
Challenge will both let me learn more in a shorter time, recall it better, and its fun to me
I like a challenge
The problem is you are asking dozens of questions in here
A lot of which you should already know, or can find on the javadocs
Which many of the questions I ask are so I dont have to do trial and error, if you noticed
That is part of learning how to do it though
Cause it takes me 5 minutes to:
Saving the plugin build
Insert the plugin again
Reloading the server
Its WHY ive been asking like 80 questions
There have only been like 3 where its not related to trial and error
And was an actual situation
Otherwise I have been learning lol
And that's why you have your IDE build directly to the plugin folder so all you have to do is build and /reload 😄
Yes but i bought a server, shockbyte
thats the issue
You can still have it auto-upload I believe.
And honestly, for testing plugins, it's a good idea to use a localhost server for quick testing.
Takes up all my cpu lol
I tried
Yikes lol
My laptop is only using 18% of CPU right now and I have Minecraft, Server, IDE, Firefox, Discord all open
I am trying to make when I spawn this wolf entity in, it automatically becomes the owner of the item holder. If you can explain what I did wrong I would appreciate it!
event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.WOLF).setCustomName(ChatColor.GOLD + "Queen's Guard");
Wolf w = (Wolf) event.getPlayer().getNearbyEntities(1,1,1);
if (Objects.equals(w.getCustomName(), ChatColor.GOLD + "Queen's Guard")) {
w.setOwner(event.getPlayer());
}
What are your computer specs
Mine is a gaming pc, using 20 with JDK, discord, google, minecraft, IntelJ
so i mean its a good pc
*using 20%
Oh, yeah. That happens.
Thats normal?
Yes.
Well damn xD
Chunk loading is extremely CPU intensive, once it starts, should be fine.
Although I've noticed it's faster in 1.18.2 for some reason, or it seems to be.
getNearbyEntites cannot be cast to wolf
You already have the wolf returned from the spawn method
So im just unlucky and made my plugin in 1.18.2
:P
1.18.1 I assume you mean?
anyone know why retexturing a black potion into a gold ingot does this?
https://cdn.discordapp.com/attachments/784855227969830972/951709353356972062/unknown.png
I mean 1.18.1 should still be fine, startup is just longer.
That's actually wild lol
i don't even know where else to ask
I guess potion ItemStack takes in a color and just applies it to whatever model it's given
On the client ^
it's just slapping the potion color on top of the texture
You wouldn't be able to stop that probably, maybe there's some color that wouldn't do that, not sure.
Yep
what have i done
wait hold up a minute tho
those actual gold ingots are slow falling potions
interesting
yeah i know
right now im just trying to get rid of the color
Could you use a water bottle instead of a potion
ah you're doing the textures rn then
water bottles are counted as potions
Or wait hang on
how can i extract the color of the slow falling potion..??
if i can somehow make the potion color to that
it might fix it
color picker?
i mean
screenshot it and put in a image editer
The wiki should have it
PotionMeta#getColor
That too
it doesn't work like that lol
#F7F8E0
potions are just one item
Yes
you set the effect/color using the meta
If you want the color to go away, I'd assume PotionMeta#setColor(null)
i've tried that
lemme see this
Don’t think that’s valid
javadoc says its nullable
Yeah it's Nullable
It's probably inheriting the color from the CustomPotionEffects if the color is null
Which have un-modifiable colors I think
?
Maybe
Convert it to rgb
they're rgb values
#RRGGBB i think
Yep
well
being hex two numbers can be any value from 0 to 255
it looks very close to white..
maybe just making the potion white will do it
LETS GOOO
white potions don't affect the color
¯_(ツ)_/¯
LOL
Maybe I should make custom textures for my drinks
Currently I just used coloured potions
do you not drink gold daily?
private static ItemStack getRandom(String crateType){
ItemStack item = null;
ArrayList<String> list = new ArrayList<String>(EmeraldsPlugin.jp.getConfig().getStringList("Crates." + crateType + ".itemList"));
for (int i = 0; i < list.size(); i++) {
int index = (int)(Math.random() * list.size());
System.out.println("Selected");
item = new ItemStack(Objects.requireNonNull(Material.getMaterial(list.get(index))), 1);
}
System.out.println(item);
return item;
}
Idk it still doesnt work lol
Doesnt error
But it doesnt actually, select something
the bound is the parameter in nextInt(int bound)
You don’t need any fancy loops, .get with a random index is fine
You get an error because the list is empty
And you can’t get a random number between 0 and 0
Obv, its like dividing 0 by 0
its nothing
?
random but constricted to 0-(bound-1)
random numbers for a computer are doubles between 0 and 1 inclusive
so calling nextInt(int bound) translates to return (integer) Math.random() * bound
ah
well i have a bigger issue to fix
"Why the list is empty"
cant help you rn
hold on, are you able to help me rq?
?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.
not what i said i just asked if they can help lo
sec, i found a small workaround
seeing if it works
@smoky oak Any reason why this isnt working?
Function:
private static ItemStack getRandomItem(String crateType){
Integer totalWeight = 0;
Random rand = new Random();
for(Map<?, ?> item: EmeraldsPlugin.jp.getConfig().getMapList("Crates" + crateType)){
totalWeight += (Integer) item.get("Weight");
}
double r = rand.nextDouble() * totalWeight;
for(Map<?, ?> item: EmeraldsPlugin.jp.getConfig().getMapList("Crates" + crateType)){
if ((Integer) item.get("Weight") >= r) {
return new ItemStack(Material.getMaterial((String) item.get("Item")), Integer.parseInt((String) item.get("Count")));
}
}
return null;
}
Config:
Crates:
basicCrate:
0:
Item: DIAMOND
Weight: 25
Count: 5
1:
Item: EMERALD
Weight: 5
Count: 25
you're missing the period at the end of the string you call the config with
i love my life
it needs to be "Crates."
Fixed, still not working however
Did I type something wrong or
It seems to be returning 0.0 for total weight
i cant cause item is a map
so the only valid functionality
is get
not getInteger
refractor that code then
get the collection of keys of the file config
iterate over it
call the getInt method
*configurationSection i mean
so getConfigurationSection
ConfigurationSection cfs = EmeraldsPlugin.jp.getConfig.getConfigurationSection("Crates."+crateType);
for(String s : cfs.getKeys()){
totalWeight += cfs.get(s+".Weight");
}```
no guarantee
I did this:
Integer totalWeight = 0;
Random rand = new Random();
ConfigurationSection cfs = EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates."+crateType);
for(String s: cfs.getKeys(false)){
totalWeight += (Integer) cfs.get(s + ".Weight");
}
double r = rand.nextDouble() * totalWeight;
for(String s: cfs.getKeys(false)){
if ((Integer) cfs.get(s + ".Weight") >= r) {
return new ItemStack(Material.getMaterial((String) cfs.get(s + ".Name")), Integer.parseInt((String) cfs.get(s + ".Amount")));
}
}
nope
did totalWeight change?
nope
you're trying to convert object to int
that does not necessarily work
totalWeight += cfs.getInt(s+".Weight");
call getInt
kk
@smoky oak hold on gotta reload my shockbyte server
it crashed after 24 hours lol
my server reloads itself automatically at 2AM
oh nice
@smoky oak guess what
its still null
private static ItemStack getRandomItem(String crateType){
int totalWeight = 0;
Random rand = new Random();
ConfigurationSection cfs = EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates."+crateType);
assert cfs != null;
for(String s: cfs.getKeys(false)){
totalWeight += cfs.getInt(s + ".Weight");
}
double r = rand.nextDouble() * totalWeight;
for(String s: cfs.getKeys(false)){
if (cfs.getInt(s + ".Weight") >= r) {
return new ItemStack(Material.getMaterial(cfs.getString(s + ".Name")), cfs.getInt(s + ".Amount"));
}
}
return null;
}
@smoky oak
11.03 07:20:24 [Server] Server thread/INFO 0.0 - 0
11.03 07:20:24 [Server] Server thread/INFO []
11.03 07:20:24 [Server] Server thread/INFO []
System.out.println(r + " - " + totalWeight);
System.out.println(cfs.getKeys(false));
System.out.println(cfs.getKeys(true));
why
it should be showing them perfectly fine
hi guys
java.lang.NoClassDefFoundError: net/minecraft/world/entity/npc/WanderingTrader
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
has this changed in 1.18.2?
maybe how you calll the method is an issue
how should I call it differently?
what i mean is that crateType should be equals to "basicCrate" exactly
if its not
null
it is
cfs is not null here right?
MemorySection[path='Crates.basicCrate', root='YamlConfiguration']
if this means it exists then yea its not null
sounds about right
System.out.println(EmeraldsPlugin.jp.getConfig().get("Crates."+crateType));
tbf this sounds like a #help-server issue
I was about to say
just wait
it can take a bit
well just wait for now
for a reply
wait a sec, how the fuck is cfs existing but getKeys returns nothing
i dont know
just saying, ive NEVER been this angry while coding
i want to scream in agony, its pissing me off
bro
you're returning null 😭
int totalWeight = 0;
Random rand = new Random();
ConfigurationSection cfs = EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates."+crateType);
assert cfs != null;
for(String s: cfs.getKeys(false)){
totalWeight += cfs.getInt(s + ".Weight");
}
double r = rand.nextDouble() * totalWeight;
for(String s: cfs.getKeys(false)){
if (cfs.getInt(s + ".Weight") >= r) {
return new ItemStack(Material.getMaterial(cfs.getString(s + ".Name")), cfs.getInt(s + ".Amount"));
}
}
return null;
}
read your code haha
?
so?
WAIT
💀
HOLD ON
💀 💀 💀 💀 💀 💀 💀 💀
THERE IS NO WAY I OVERLOOKED THAT
💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀💀 💀 💀 💀 💀 💀 💀 💀
all good brother
we've been there done that
why would you return null in the first place lmao
yea with what
java.lang.NoClassDefFoundError: net/minecraft/world/entity/npc/WanderingTrader at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
if that doesnt fix it see if EmeraldsPlugin.jp.getConfig.getConfigurationSection("Crates.basicCrate.0.Weight") returns the actual number
very confused
have you tried to google the error
have you checked that
Like this correct?
maybe my mapping?
private static ItemStack getRandomItem(String crateType){
int totalWeight = 0;
ItemStack item = null;
Boolean found = false;
Random rand = new Random();
ConfigurationSection cfs = EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates."+crateType);
assert cfs != null;
for(String s: cfs.getKeys(false)){
totalWeight += cfs.getInt(s + ".Weight");
}
double r = rand.nextDouble() * totalWeight;
System.out.println(EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates."+crateType));
for(String s: cfs.getKeys(false)){
if (cfs.getInt(s + ".Weight") >= r && !found) {
item = new ItemStack(Material.getMaterial(cfs.getString(s + ".Name")), cfs.getInt(s + ".Amount"));
}
}
return item;
}
ye i guess
?paste
whoops
nice
wait do you know where to find the mapping for each jar release
or whatever
like i just manually changed it from 1.18.1 to 1.18.2
OH
have a feeling maybe something chjanged
yea probably
Nope, still not working lol
Code:
private static ItemStack getRandomItem(String crateType){
int totalWeight = 0;
ItemStack item = new ItemStack(Material.TNT, 1);
Boolean found = false;
Random rand = new Random();
ConfigurationSection cfs = EmeraldsPlugin.jp.getConfig().getConfigurationSection("Crates."+crateType);
assert cfs != null;
for(String s: cfs.getKeys(false)){
totalWeight += cfs.getInt(s + ".Weight");
}
double r = rand.nextDouble() * totalWeight;
for(String s: cfs.getKeys(false)){
if (cfs.getInt(s + ".Weight") >= r && !found) {
item = new ItemStack(Material.getMaterial(cfs.getString(s + ".Name")), cfs.getInt(s + ".Amount"));
}
}
return item;
}
Config:
Challenges:
BlockDamage: false
Hunger: false
BlockBreakList:
OBSIDIAN: 10.0
DIAMOND_ORE: 10.0
EMERALD_ORE: 10.0
LAPIS_ORE: 7.0
GOLD_ORE: 7.0
REDSTONE_ORE: 7.0
IRON_ORE: 5.0
COAL_ORE: 3.0
Crates:
basicCrate:
DiamondReward:
Name: DIAMOND
Weight: 25
Amount: 5
EmeraldReward:
Name: EMERALD
Weight: 5
Amount: 25
Maybe I typed my YML file wrong
or smth idk
No errors, its returning TNT, not the actual item I want btw
(I set TNT as a base so that errors dont occur)
?paste @quaint mantle
short question, buildtools says 1.18.2 is out but latest generates 1.18.1
is 1.18.2 finalized already?
?
alright
is the ide giving you an errorr?
where?
Red
h
you need to define it before the for
so do ItemStack item;
before the for()
then it should work
isnt it already defined before the for?
no
OH WAIT
?
k
there
isnt it going to error however?
then the for isn't happening
did you mean place ItemStack item ouside of getRandomItem?
so inside of public class Crate?
no
public class Crate {
private static ItemStack getRandomItem(String crateType){
int totalWeight = 0;
ItemStack item;
then idk what you mean lol
cause its deff above both for statements
so i dont have to do new Crate.getRandomItem()
or whatever
hm ok fien
why not use static?
okay wait, so how do I overwrite a statement?
you already done it
you sure?
meaning that there must be no false keys
i think
@quaint mantle that should theoredically work
but that can't be the problem
it doesnt let me create the build however
cause there is an error
anyone god the mapping guide
Crates:
basicCrate:
DiamondReward:
Name: DIAMOND
Weight: 25
Amount: 5
EmeraldReward:
Name: EMERALD
Weight: 5
Amount: 25
yes
it is
ill rename it tho
org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-obf
is this correct?
Failure to find org.spigotmc:spigot:jar:remapped-mojang:1.18.2-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/
i dont see why not
@raw ibex That wasnt the issue
Hmm
Why is .getKeys returning none?
what
Hi, I was using a 1.18 local host, but now I must to use one in 1.16.5
However when I run BuildTools to install 1.16.5 server I get this error:
´´***The version you have requested to build requires Java versions between [Java 8, Java16], but you are usin Java 17
** Please rerun BuildTools using appropiate Java version. ´´
I understand the error, but is there a way to change it without uninstalling Java 17? Just switching the default version or something
someone wanna see a funny error? https://paste.md-5.net/unocodejod.cs
sure, just give the full path to your java8 installation
e.g.
C:\Program Files\Java\Java8\bin\java.exe -jar BuildTools.jar
Ohh thanks!
yes but you have to run buildtools beforehand
are you using git bash or the normal windows command prompt?
Now I'm using windows command prompt, but I have git bash installed
if you're using bash, you can just create a .bash_aliases file
so you can do java8 to run java8, java17 for java 17, etc
is spigot 1.18.2 stable by now? building latest spits out 1.18.1 but buildtools says 1.18.2 is the latest version
I didnt have any problems and after all it's been released almost 2 weeks ago I think
public static Plugin fromSpiget(Plugin plugin) {
final int id = plugin.id;
final String name = plugin.name;
final String thumbnail = plugin.thumbnail;
final String version = spigetApi.getVersion(id);
final int downloadId = spigetApi.getDownloadId(id);
final PluginUpdate lastUpdate = spigetApi.getUpdate(id);
final int updateId = lastUpdate.updateId();
final long timestamp = lastUpdate.timestamp();
return new Plugin(name, version, id, updateId, downloadId, thumbnail, timestamp);
}
Anyone here like final local vars? lol
does anyone know if I can get rid of this warning? From what I know, I cannot check for the generic types at runtime anyway soooo isn't the whole warning pointless?
I’d just suppress the warning
yeah I just thought maybe checking at least if it's instanceof Map would avoid the warning but still, no
Nah
I just wonder why it throws a warning if it HAS to be suppressed anyway :/
there must be SOME other way I guess
cant you throw an instanceof arond that
Not with generics
no, the runtime doesn't know the generic type
You can check instanceof Map but not instanceof Map<K, V>
it gets erased on compile time
yeah :/
anyone have a good idea for a name for my spigot update checker discord bot? I'll release it on SpigotMC so I need a more friendly name than "DiscordSpigotUpdateBot" lol
guys how can i get event.getplayer from non event method
whut?
made an arraylist<Player>, added p in it but i need to equal p to the e.getPlayer
I don't get it
ArrayList<Player> set = new ArrayList<Player>();
Player p = null;
set.add(p);
}```
yeah that makes no sense
can you please just explain what you are trying to achieve
I'm trying to make the "p" be accesable from all events.
You really need to learn Java man
the whole method makes no sense
Could not find artifact org.spigotmc:spigot:jar:remapped-mojang:1.18.2-R0.1-SNAPSHOT in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/) -> [Help 1]
do you have the name for the mapping jar(s)
as I told you earlier and as the blog post also states, you have to run buildtools
@tender shard they’re trying to add players who died to a set and reference that set later but they don’t know enough Java to accomplish it or understand what they’re even trying to do
No
You can’t use the bootstrap as a dependency lol
no
?paste your BuildTools.log file
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.
lol how do you know that
shouldnt this be in the directory of my buildtools jar
Because they’ve been asking questions about it since last night
idk why its not there
yes
ah ok
@tender shard should the name be in the buildtools log
bro
you don't need any .jars name
you are using maven to handle your dependencies
I asked you to send the log file
does package rename reflect on github after merging it directly on the main branch, I renamed my old shitty package name to all lowercase
Yes should do, just push upstream
thanks, Was conscious on what github desktop is showing with the changes. Though it wasn't reflecting it
tried it, the package names on github are still in uppercase
yeah just changing capitalization doesn't really work
rip
change the name to something else and then change it back
how do I change it
like you did it the last time?
I did it on github desktop, and pushed it from there
so do it again
git config core.ignorecase false
thanks the git command recognized the changes
why does this not work ...
because there is no constructor called TextComponent(String)
you wat to use TextComponent.fromLegacyText(String)
hoiw do i make a clickable text then ? this was what i found on the internet
Actually it depends
Are you converting from color codes
or are you creating a new component with some plain text?
i dont know what you mean by this
Oh you're importing the wrong class
yeah its the only class that intellij prompt me
did you add spigot-api to your dependencies?
And also there is
where?
theres no spigot one
In the fucking documentation, therefore probably in the class
no
?paste
yes that's outdated
yeah
oh 1 sec
was this a thing on 1.8.8 ?
what's your version?
1.8.8
Lombok probably adds the constructor
ugh
Also no this API does not exist for 1.8 iirc
oh yeah I didnt think about that at all lol
Also I know that constructor exists because I've seen it in 1.18 :p
meh, I prefer adventure
it seems to exist in 1.8
Either way you'd want a ComponentBuilder
Oh
Do you use Gradle or Maven? @west oxide
yeah but i cant find this import
neither
i think am using the default thing from intellij idea
do you have a build.gradle file?
Use one, that API is not built by BuildTools
do you have a pom.xml file?
nice quality
yeah best screenshot ever
ITS BEST I COULD DO
looks like JPG with quality set to -17
import net.md_5.bungee.api.chat.TextComponent;
?
?
no
The Chat Component API is available from the Sonatype Maven repos
neither
wow lol
you should use either maven or gradle
it'll make everything so much easier
your problem is:
Yeah
is there a way to access nms with maven
you imported spigot-api.jar
but you must use the shaded .jar
yes
if you're on 1.16 or older: https://blog.jeff-media.com/using-nms-classes-with-maven/
yaeh ik but i tried to and for some reason the dependency for maven of a plugin that am making an addon wouldnt work so i just used this
wait what
you must use the shaded .jar file
ty
or let maven handle your dependencies
yes buildtools
.
Still, use Maven :p
lol
If it "wouldn't work," then you fix it
Hello, I'm making plugin where when you walk it spawns glowstone below you (except air). So I was wondering how do I create function for every time event gets triggered (im trying to replace glowstone with old block after 1 second)
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import java.util.concurrent.TimeUnit;
public class PlayerMoveListener implements Listener {
@EventHandler
public void onMovement(PlayerMoveEvent e) {
Player player = e.getPlayer();
World world = player.getWorld();
Block block = player.getLocation().subtract(0, 1, 0).getBlock();
Material type = block.getType();
if(type != Material.GLOWSTONE && type != Material.AIR) {
block.setType(Material.GLOWSTONE);
player.sendMessage("asd");
block.setType(type);
}
}
}```
i asked the dev and he told me that some server is down and he cant fix rn
u can add file dependencies
yoo thank you
in maven
how
google it
Yeah you can use file dependencies
ive done it before
i didnt know that
<scope>system</scope> but
yeah i ll just do that
does work tho]
using mvn install:install-file
today yes, tomorrow it might be removed
you should probably give him the full rundown
I'll write a blog post on how to manually install .jars to maven repo
for what exactly?
aaah I see
this
yeah
btw
@lavish hemlock are you the on on the forums ?
i ve seen a similar pfp to yours many times
yeah I'm the on on the forums
ooh thats nice
so you want to replace it only for 1 second?
yeah nvm
lmao
mb i thought this was you lol
I'm still not quite sure what "the on on the forums" means
it's not quite English
yes
yeah its just that i see that guy alot of times
What does that have to do with what I said
I would suggest using fake blocks
You could use a scheduler
so no permanent things are made
I want it to make block under player glowstone, wait 1 second and set it back to original block
i meant by "the one on the forums" the guy i showed you the pfp of rn and cuz i thought it was you but apparently its notl
am just dumb lol mb
ill try that
run task later
Well either way I wouldn't know who you're talking about
^^
I have a forum account but "the one" is not descriptive
This is me
well if you had the same name/pfp from your forums acc on your discord and was active on forums you would have probably thought that i recognized you from forums
F
i think they are trying to do like a trail thing
for all players to see
ur pfp isnt so
to whoever needed mvn install: https://blog.jeff-media.com/manually-installing-jar-files-to-your-local-maven-repository/
Send it to all players
@west oxide I think it was you
yes
But that's the safest way to do it anyway
why not just do a scheduler task?
a scheduler that does what?
You could loop through all the players and set that block so it doesn't change the map
Oops
Replied to wrong person
And if the server crashes or something happens, the changes are permanent