#help-development
1 messages · Page 1599 of 1
@torn shuttle tysm! are there any starter projects you'd recommend?
hm
honestly it's down to your own personal interest and what you want to do with spigot
I'd recommend not starting with modifying chunks
and not starting with nms
stick to the api and maybe stick to doing something with players
my first plugin was a recreation of the just cause 3 grappling hook mechanic and retroactively I think it was a pretty good point to start at
join messages but only on first join, then make a counter for how many total players have joined and send that when sending the join message
if you know java it should not be too hard
the wiki also has some sample plugins if you want some real basic examples to follow
what's JavaSoft registry keys?
I've not used those, not sure what they're for
mk
if(block.getBlockData().getMaterial() == Material.SPRUCE_DOOR && itemInHand.getType() == Material.STICK && itemInHand.getItemMeta().getDisplayName().contains("Lockpick") && player.isSneaking() == true) { ItemStack lockpick = player.getInventory().getItemInHand(); lockpick.setAmount(lockpick.getAmount()-1); Random r = new Random(); player.getInventory().setItemInMainHand(lockpick); int precent = r.nextInt(100); if(precent > 29) { player.sendMessage(ChatColor.RED + "Lockpicking didn't work. Your lockpick broke."); return; } block.setType(Material.AIR, true); player.sendMessage(ChatColor.GREEN + "Lockpicking worked! Door has been destroyed."); return;
does anyone know why if I have only 1 stick the door breaks in half?
You need to set both top and bottom to air
sorry to interrupt but q question:
how can I put more than 1 GB into my test server if needed?
@echo off title Server Console java -Xmx1G -jar testserver.jar PAUSE
is the code
would i just change the -Xmx1G to like -Xmx3G or so...?
Aikar's garbage collection flags: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
??
where...?
For some reason I can’t access that webpage 
It's slow give it a min or two
@echo off title Server Console java -Xmx1G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paperclip.jar nogui -jar testserver.jar PAUSE
so like this?
Oh yeah literally took 2 mins wow
Yeah ig
do you mind showing me how?
Hi, I am facing a dilemma which im unsure about how i can fix it properly.
I have a (part) of a plugin which functions like a tinkers' tool, there is a modifier which auto-repairs on a async timer (it needs the itemmeta to add durability (this becomes important)).
Meanwhile when you perform an action you will get experience on the tool and eventually level-up (gets stored in a namespacekey (also in the itemmeta)).
This will on rare occasion result on the itemmeta being written to at the same time and somehow corrupt (i assume) it that it looses enchantments/lore/displayname (not all the time, sometimes partially).
I had this idea to make some sort of event queue where every action needed is done one after another per tool, but the part i am unsure about is how to 'save' the tool (which keeps being used and thus changes).
Is there any way of achieving the above or make it like only 1 source may edit the itemmeta at a time?
But will that fix the issue, the repair is on a timer but the exp gain is immediate as the action is performed?
If it's sync multiple things can't happen at once
And you won't have issues with corruption
I have a question that I'm interested in so how do you guys learn java (with yt tutorials, books etc.)?
?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.
Or in general start with coding
Punch cards, then manual mnemonic to hex conversion by hand for Z80 asm
With these links?
no, thats how I started
Step 1. Learn C#
Step 2. Code in Java
but that was 40 years ago
I don't wanted to know that because I want to learn java... btw
well these links are fairly useful
ik
Learn programming concepts in general, especially data structures and some simple algorithms
But I think YouTube videos are also veeery usefull
learn OOP before diving deep into any language
Yeah true
This is very helpful
Yeah I learned most of my stuff back then from indian youtubers xdd
You first have to get a brief look into how coding in general works
ThinMatrix on YT is a good channel to learn basic java
Not to me I learned java from tutorials and looking at forums
It's also a nice way
I actually self learned a little
I never specifically learned java tbf, I just used my JavaScript and C++ knowledge to just go ahead and write stuff. That's also the reason why it was so terrible code back then
Do you guys know Alex lee? in my opinion he's making the best tutorials on java ever
Idk I'm pretty average at java
I learned a little bit of lwjgl but all I can do is make a window with a background color of choice
2
Why? @eternal oxide
I used Eclipse in 2019 and honestly, the experience with IDEA has been so much better for me.
So true
I started with Eclipse, its free, and I like an IDE that lets me do what I want without nagging me. I also find it light weight and easy on memory
Especially I remember trying to import and configure dependency JARs and I was so lost doing that. And nowadays I just use Gradle and reload the project and 🎉. So much cleaner, but I guess that's not specifically a point for Eclipse/IDEA.
Switch to intellij was the best decision in my life just the fact that it's looking so cool especially with material theme UI
Intellij is also free
no its not
Ultimate is paid, the Community Edition is free
The community edition works for almost everyone perfectly fine
just submitted a define for deskist
Ultimate only gives you useless stuff like JavaScript support lol
And for JavaScript, just use VSCode or Atom
now waiting for it to get accepted
I have Eclipse with DevStyle for Themes and its great.
Themes
eh, that looks better than the default theme but not that good imo
this still looks quite a bit better imo.
Not really anythign in it
Hey, i'm having a problem with my code
I'm trying to do so everytime someone mines granite, it would give
50/100 chance of dropping coal
40/100 for iron
10/100 for diamond
but on my server, this code doesnt work and gives me coal, iron, and diamond at the same time
code :
other than my text is larger as my eyes are older
text is probably the same, my monitor is just quite large
I have this yml file, how can I make it so that when the player clicks the slot defined in the file it does something?
'0':
name: Maçã
slot: 10
price: 10000
id: 260
2560x1440
change those || to &&
can you cast a object back to its original class without having to make a massive switch statement and check manually
you could track the Class<?> somehow, but otherwise no?
i guess i could add the class to a hashmap
Does anyone know how to get a player head as a falling block?
i was kinda looking for a way to do it without tho
i need the original class and not the one extending or the method im calling isnt gonna be the method of that original class
like BClass extends AClass i want to get the original class which is BClass but i have a AClass
wth are you trying to do
^
Are skulls blocks? Because they cant be falling blocks
idk but all i got is a thing that implements a interface and i put it in a hashmap of that interface but now i cant get the actual class out of it
cast it?
i dont know the original class
Sounds like a bad design
I really don't quite understand why, but probably adding a Class somewhere would help.
but yes ^
oh i see, are you trying to access a method in the subclass?
also how do you convert a List<String> to a String[] lmao
toArray iirc
did you cast it to String[]
E[] arr = collection.toArray(new E[0]);
Or smtng but that’s pretty much a google question
you still haven't really said what you're trying to do
And where does the error come from?
Doesn’t seem to be existing in that picture if yours
from package
it looks like your ide has forgotten the jdk exists lol
do you even have the jdk present in your project? it looks like it cant fin dit
i dont use eclipse but you should see the jdk somewhere as a library
do you know how to stop mc launcher from corrupting
i have no idea then, try rebuilding your project or reimporting it or clearing the cache
ok i will try
if I delete import org.bukkit.inventory.ItemStack; or import org.bukkit.Material; then the problem goes away
but I need both
yeah becauise i assume ItemStack uses java.util.Map
but your ide can't detect the jdk for some reason
is there any way i can debug a plugin with intellij? or keep track of something while playing? or something, idk, i literally have no idea whats happening with an inventory im using as gui, an item is being removed, always the same, for some reason, in the slot 9, but instead of setting the slot 9 as null, the rest of the array is shifted down, making the last index to be null
there is some guide somewhere to set up some level of debugging, though you can't use breakpoints for more than like 30 seconds otherwise the client times out
setting a breakpoint can corrupt a world or something? or is it safe
What IDE are you using?
Eclipse
bc this bug only happens on my server, not on the test one
goto Help -> about and show me that window
What JDK do you have installed?
i think 16
it just suspends the program, though the client will time out from the server and there's no way to change that other than a mod on the client
go to Window -> Preferences, then Java and expand it to select Installed JRE's
is there a mod for specifically that?
oh it's 14
and is it a JRE or JDK?
i have no idea, but you will also need to change the timeout threshold on the server, though i think tha tvalue is configurable
jdk
is it Java or another brand like Adopt?
it is java
ok, so long as its ticked, select it and press edit
done
does it have a JRE home and JRE name filled in?
yes it does
um, then it should be working
how can I remove everything from the end?
I want to make a void world on the end dimension
You could try Project menu -> clean
whats this?
wasn;t to you, sorry
oh ok np
i have already done it and nothing changes
yeah but im gonna fix it tmr but i tried to but it says i cant cast Object[] to String[]
My only suggestion at this point is delete your Eclipse and install fresh
gives me a null pointer error
Send code
tmr :)
ok i guess that's my only option
Also ftr arrays don’t extend object nor object array
They’re quite special
Or well they do extend object
But not Object[]
no but .toArray gave me Object[]
it did tho
You’re officially lying
is ti possible to override the lines in config with different onesz and save that?
Arrays.asList gives you a java.util.Arrays.ArrayList.
i already have List<String> i want to convert it to String[]
list.toArray(new String[0]);
i will try that tmr
anyone?
dude be patient
Yes Nerd it’s fully possible
k
hey, whenever this line of code is executed, i always get n org.bukkit.EventException: null and Caused by: java.lang.NullPointerException
all these errors shows whenever i do a single player interaction.
these errors points to one of my class' line 57 which is
if(it.getType() == Material.COMPASS && it.hasItemMeta() && it.getItemMeta().hasDisplayName() && it.getItemMeta().getDisplayName().equalsIgnoreCase("§4§lMenu Admin"))
is there a way to ignore null whenever this line is executed ?
it justs floods my console
no something is null, meaning you cant call a function on it
you can't just "ignore" it
this line checks if i have an specific item in my inventory to do an action
but whenever i don't have it, it throws this error
Extract that nasty predicate, anyways how do you know it isn’t null?
it is probably null at the beginning.
I assume you're iterating over your entire inventory?
and if theres no item in a slot, I think that slot is then just null
so you have to take that into consideration
so add to teh beginning if(it != null &&
^
thanks
yep, it's that
I'd like to make a spawn lobby on another dimension, is there a way to remove all blocks from it?
do u have mutliverse
if so, you can with a plugin, generate a new world with just void
but I'd like a void dimension
on the same world
so players can teleport from the lobby to the overworld
Thanks I reinstalled it and now it works 🙂
still working on trying to figure out whats wrong with my code from last night, now Im getting this error, any idea whats going on?
(above has error and code)
Whats teh actual error?
thats not the full error
at least 1 line above that
We need to see the FULL error
1 line above it is the line at the very end I just assumed it was looping sorry
thats just a list of classes, we need teh actual error
ok stack overflow, your spawn is a constant loop triggering more spawns
Because teh event is cancelable the event fires Before teh entity is actually spawned, so when you check for <4 that value never increases because yoru event never gets to end
OH
the entity doesn;t exist in teh world until your event finishes
Hello again
so
I did not succeed in restarting the servers because I need java 16
But I don't know how to install it
@quaint mantle how did you do?
easiest fix, is alwasy count ChunkEntites +1 and fire yoru spawn event in a runTask so it happens 1 tick later
ahhh
I was thinking of checking before I despawn the entity
that should also work right?
If you also use the spawn method with a consumer you can do any alterations to your slime before it is spawned.
ahh alright
i cant debug the plugin, im using the 2nd method https://www.spigotmc.org/wiki/intellij-debug-your-plugin/
i get this error on the sv jvm
ERROR: JDWP Specify launch=<command line> when using onthrow or onuncaught suboption: -agentlib:jdwp=transport=dt_socket,server=n,address=DESKTOP-EPTVBLM.mshome.:5005,suspend=n,onthrow=<FQ
how i start it
& $java -agentlib:jdwp=transport=dt_socket,server=n,address=DESKTOP-EPTVBLM.mshome.:5005,suspend=n,onthrow=<FQ exception class name>,onuncaught=<y/n> -jar $server_jar --nogui
$java is just the path to a java16 installation, and $server_jar the path to the sv jar
if you don;t want that entity to spawn you cancel the event not remove()
alright! Thank you!
Is there a way to consume/don't leave behind the bucket for a recipe which takes in a water bucket?
I want to make a plugin that when you break a block the drops will be random and the number of items is also random but I don't know how to put the number of items in if I have a variable called block can someone help me? ```java
public void onBreak(BlockBreakEvent e) {
Block block = e.getBlock();
Player player = e.getPlayer();
this.plugin.getConfig();
if(!e.getBlock().getDrops().contains("COMMAND")
|| !e.getBlock().getDrops().contains("DEAD") ||
!e.getBlock().getDrops().contains("FIRE")
|| !e.getBlock().getDrops().contains("WATER") ||
!e.getBlock().getDrops().contains("LAVA")) {
Material rmat = mats[ran.nextInt(mats.length)];
int r = ran.nextInt(600)+30;
while(rmat.name().contains("COMMAND") || rmat.name().contains("DEAD")
|| rmat.name().contains("FIRE") || rmat.name().contains("WATER")
|| rmat.name().contains("LAVA")) {
rmat = mats[ran.nextInt(mats.length)];
}
HashMap<Material, Integer> map = new HashMap<Material, Integer>();
this.plugin.getConfig().set("blocks", block);
this.plugin.getConfig().set("blocks", arg1);;
} else {
return;
}
}```
yeah if its a specific recipe just set the slot its in to air
so I have to listen to all the recipe events?
anyone?
Its posible to set the view distance to an armor stand name?
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
this is for a config.yml
I know what this is
I need help with config
please help in #help-server
What do you need help with
I want to make a plugin that when you break a block the drops will be random and the number of items is also random but I don't know how to put the number of items in if I have a variable called block can someone help me?
public void onBreak(BlockBreakEvent e) {
Block block = e.getBlock();
Player player = e.getPlayer();
this.plugin.getConfig();
if(!e.getBlock().getDrops().contains("COMMAND")
|| !e.getBlock().getDrops().contains("DEAD") ||
!e.getBlock().getDrops().contains("FIRE")
|| !e.getBlock().getDrops().contains("WATER") ||
!e.getBlock().getDrops().contains("LAVA")) {
Material rmat = mats[ran.nextInt(mats.length)];
int r = ran.nextInt(600)+30;
while(rmat.name().contains("COMMAND") || rmat.name().contains("DEAD")
|| rmat.name().contains("FIRE") || rmat.name().contains("WATER")
|| rmat.name().contains("LAVA")) {
rmat = mats[ran.nextInt(mats.length)];
}
HashMap<Material, Integer> map = new HashMap<Material, Integer>();
this.plugin.getConfig().set("blocks", block);
this.plugin.getConfig().set("blocks", arg1);;
} else {
return;
}
}```
Oh man there is so much wrong with this
What is my main directoy ?
?paste Can you put it in a paste
So it is easier to read
k
how do I select language java?
U don’t need to
in md_paste
k
It detects automatically
Yep thanks
first do your drop items in the config
For the first bit here, I think you would need to do the .contains differently
already stopped
what do u suggest?
What it means is the set of drops contains this string
@opal juniper https://paste.md-5.net/ihugigofer.cpp
What are you trying to do?
hoe should I check if the random thing contains something?
No - what is the overall goal of this code
What are you trying to do
And I can help u from there
u want to set random number of drops from a block?
I know how to do that I just don't know how I can put it in the config
@opal juniper I want Random drops and a random amount of them I have that but I don't know how to put the amount of drops in the config so it will drop
Oh right ok
thisw is the problem
So when a player breaks a block a random amount of the drops appear?
HashMap<Material, Integer> map = new HashMap<Material, Integer>();
this.plugin.getConfig().set("blocks", block);
this.plugin.getConfig().set("blocks", arg1);```
yes I want it in a config .yml
what arg1 is?
idk I idk what to put there
I want to put Material rmat = mats[ran.nextInt(mats.length)]; rmat in there
I’ll let Gramsln help
to obtain a info from hashmap u need hashmap.get(key)
I want it like this blocks: DIRT: - therandomblock, randomnumber
?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.
ignore that
I have done the blocks: DIRT:
Idk how to put the random block and amount in the config
plug.getConfig().getConfigurationSection("").getKeys(false).forEach(key ->{
});
wait
That ain’t how yaml works
wait let me do the code
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Meh
You don't put the amount in the config. Thats random every time, its only the drop the replaced
OHHHH
So I don't need to put the amount
no
you randomize teh amount every time a block is broken
? set(item)
Hey ElgarL I had an idea for the name of your pathfinding algo:
ElgarL - rithm
please laugh
but what if I want a lot of the same thing
its a random amount every time
yes, you just generate a random number of whatever magnitude you want each block break
so u dont need to set in the config? xD
i mean i dont what is trying to do xD
k
so im helping with what is asking
then thx XD
its basically a Material replacement Map. Whenever the key Material block is broken the value is what Material type ItemStack drops
I improved it last night, Works much farther out and faster
The first thing you should do is that the items are dropped with a random number.
Then if you want to change from how many to how many I recommend doing a config by hand. to later obtain the data in the code
No, while is bad and that code will not work. If that ever triggers your server will crash
you need to think how you handle the code
ItemStack item = new ItemStack(BetterWarps.warps.get(index).material, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(BetterWarps.warps.get(index).name);
if (!BetterWarps.warps.get(index).description.isEmpty())
meta.setLore(Arrays.asList(BetterWarps.warps.get(index).description.split("\\\\n")));
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.addItemFlags(ItemFlag.HIDE_DYE);
if (BetterWarps.warps.get(index).enchanted == 1)
meta.addEnchant(Enchantment.ARROW_DAMAGE, 1, true);
item.setItemMeta(meta);
inventories[page].addItem(item);
all the items are being added to the inventory page (wich i create like this Bukkit.createInventory(null, int, String)) successfully, EXCEPT this one, for some reason that i dont know
ItemStack{FROSTED_ICE x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":"Ice"}],"text":""}, lore=[{"extra":[{"text":"A lot of ice"}],"text":""}], ItemFlags=[HIDE_ENCHANTS, HIDE_ATTRIBUTES, HIDE_DYE]}}
it is like inventories[page].addItem(item) is doing nothing with THAT SPECIFIC ITEM, without any errors, why?? i literally spent hours trying to fix this, and i still dont understand why this happens
so get rid of while?
you shoudl not be adding anything to yoru map in yoru blockBreak
you generate your Map before your plugin starts (load from config)
Cooool
BetterWarps.warps.get(index).material show this
how should I do in my onEnable?
then in BlockBreak you if (map.contains(e.getBlock().getType))
I have enlisted (he offered) the help of GodCipher now wit the plugin
you store Map<Material, Material>
Doing this shit with unloaded chunks is a pain in the arse
its Material.FROSTED_ICE, is that what you mean?
why? I need the block player broke
BetterWarps.warps.get(index) i need o see this method
or what value has index
if warps is an hashmap
Material mat = e.getBlock().getType();
if (map.contains(mat)) {
// drops will be
new ItemStack(map.get(mat), randomAmount);```
k
so I
so I'm having an issue with this ```java
if (!cooldown.isOnCooldown(player, "dailyKit", 86400000)) {
Kits.DailyKit(player);
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6You have received kit Daily."));
cooldown.setTime(player, System.currentTimeMillis(), "dailyKit");
} else {
long i = cooldown.getTime(player, "dailyKit") + 86400000 - System.currentTimeMillis();
player.sendMessage(ChatColor.RED + "You can't use that kit again for another: " + ChatColor.GOLD + Cooldown.convertTime(TimeUnit.MILLISECONDS.toSeconds(i) * 1000));
}
show your isOnCooldown method
ah, its an arraylist of instances of this class
public class Warp {
public String name;
public String rawName;
public Material material;
public int enchanted;
public String description;
public Location location;
public Warp(String name, Material material, int enchanted, String description, Location location) {
this.name = name;
this.rawName = name.replaceAll("§.?", "");
this.material = material;
this.enchanted = enchanted;
this.description = description;
this.location = location;
}
}
specifically that ice warp object is this
public boolean isOnCooldown(Player player, String cooldown, int ms) throws SQLException {
return getTime(player, cooldown) + ms - System.currentTimeMillis() > 0;
}
.
use this method for createItemStacks
//Method createItem
public static ItemStack createItem(String name, Material mat, List<String> lore){
ItemStack item = new ItemStack(mat, 1 );
ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName(name);
meta.setLore(lore);
item.setItemMeta(meta);
return item;
}```
so if they have no entry getTime should return zero?
yes
check getTime IS returning zero when there is no cooldown
omg LMAO
when I tried fixing before I never replaced the jar
and when I just placed the jar its fixed
🙂
it's not returning zero...
then thats what you need to fix
hm
Your allowed to do if (res.getString("UUID") == null) right as res being ResultSet res = psa.executeQuery();
of course
zero or a negative number should be fine
you should probably have a constraint for UUIDs to not be null anyway
constraint?
as in your schema does not permit the UUID column to have null entries
like a restriction?
but i'm just guessing what your data structure looks like
if (res.next()) {
if (res.getString("UUID") == null) {
return time = 0;
} else if (res.getString("Cooldown") == null) {
return time = 0;
} else if (res.getString("Time") == null) {
return time = 0;
} else {
return time = res.getLong("Time");
}
``` this is what it looks like
sysout what it is returning
we are really only interested in what value getTime returns
so long as you name them differently in cooldowns its fine
still the same thing, almost the complete class, just in case, idk
public class WarpsInventory implements Listener {
private final Inventory[] inventories;
public WarpsInventory() {
int inventorySize = 9 * (int) Math.ceil(BetterWarps.warps.size() / 9.0);
int pages = (int) Math.ceil(inventorySize / 54.0);
if (pages == 0) {
inventories = new Inventory[1];
inventories[0] = Bukkit.createInventory(null, 9, warpsInvGUITitleSinglePage);
return;
}
inventories = new Inventory[pages];
int index = 0;
// iterate over pages
for (int page = 0; page < pages; page++) {
inventories[page] = Bukkit.createInventory(null, Math.min(inventorySize, 54), pages > 1 ? warpsInvGUITitle.replace("{page}", Integer.toString(page + 1)) : warpsInvGUITitleSinglePage);
inventorySize -= 54;
// iterate over each slot of the page
for (int slot = 0; slot < 54; slot++) {
// previous page button
if (page > 0 && slot == 0) {
ItemStack item ... // stuff for a banner with an arrow
inventories[page].addItem(item);
}
// next page button
else if (pages > 1 && slot == 53) {
// the same thing above
inventories[page].addItem(item);
} else {
warp warp = BetterWarps.warps.get(index);
ItemStack item = createItem(warp.name, warp.material, Arrays.asList(warp.description.split("\\\\n")));
inventories[page].addItem(item);
if (++index == BetterWarps.warps.size()) break;
}
}
}
}
public static ItemStack createItem(String name, Material mat, List<String> lore){
ItemStack item = new ItemStack(mat, 1 );
ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName(name);
meta.setLore(lore);
item.setItemMeta(meta);
return item;
}
How would I go about replacing the default logger in spigot (the PluginLogger, replaced with my own ver of the java Logger)
Not sure if it's possible to replace the JavaPlugin#getLogger's return but thought i've seen it before
Perform certain actions on send and just make the messages more detailed to my liking
you just add it as a handler to yoru logger
yeah I did
One of the cooldowns work
but the others don't
This works well without 1 item exception?
oh nvm your not talking to me
yea
the frosted_ice
apparently that cant be placed in an inventory, but idk why addItem doesnt throw an error or something
@eternal oxide Honestly your gonna wanna see this in a screenshare or something it's acting really weird too much to explain
Check the material.name is correctly
Hi I would like to create an Euler angle for an amorstand which point to north (I've been google this but ngl I didn't understand a thing about euler angles)
I've got this pointing to west from but I can't manage to transform it forumsarmorStand.setHeadPose(armorStand.getHeadPose().add(0, -Math.atan2(location.getX(), location.getZ()) + Math.PI / 4, 0));
I dont understand what im doing wrong here, is it because i still have the 1.8 spigot version implemented into my plugin? Or is it because i didnt specify an api version???? Or am i just stupid??
he asked three questions--
Update your library to 1.17
Im not using Intellij, atm im using Eclipse
yes.
Ill show u my code so u understand
I don't need to see your code, you need to update the library for spigot you are using.
I mean i have 2 jar files implemented atm, 1.17.1 and 1.8
Remove the 1.8 one
Ok
And it should then throw an error as that method doesn't exist since 1.13 I believe
Now i have many errors.
Yep
You need to edit it for 1.17
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Like many errors being it doesnt know what "a click method is" and what "chatcolor" is
And etc
maybe you should update one minecraft version at a time
You may not have the correct lib then
Oh im not doing a mass update, im just making a version of my plugin for 1.17
what do you mean
^
I mean, i wouldnt say its "fucked" if i had an project going with 2 versions and it never has had errors, but k
i presume that this is not maven
Yeah i have errors because spigot 1.17 is being stupid
bruh
Im using eclipse, im like 80% sure it automatically makes u use maven but you cant implement any maven dependacies.
may we see what the ide says are the errors
Yeah hold up
Do you have M2Eclipse?
Also why the agreesion? Lmao
yeah why
Cool thanks discord for taking 100 years to process my typing.
Bukkit issue
And it says this for everything else when i hover over it
i am unsure of whether eclipse makes projects maven automatically, but i sort of doubt it, because my friend develops a plugin with eclipse and adamantly refuses to use maven
Dude like i been saying to u for the past 50 times now, i have spigot 1.17 imported as a jar file.
Hm ok
quick question: are you using the 1.17 or 1.17.1 api
Dude can you chillaxe?
1.17.1 jar file
okay
for maven, should all compile-scope dependencies be shaded
or should shading be avoided
avoid if you can
what situations would require shading
Omg the:
}else if (false){
return false;
}
i can see ppl doing that tbh
When you can;t avoid it 🙂
yes, and compile does
however, Spigot now has the libraries feature in the plugin.yml
i am not referring to the scope as the issue, by the way
i am mainly referring to the shade plugin
and whether to use that for compile-scope dependencies
okay
So should i restart than?
If you are building for 1.17 use libraries in plugin.yml instead of shading
no no
dishy, you are not including the spigot jar in your plugin
it is provided, so it is not necessary
the yandere dev
provided meaning that it is already present when the plugin has to run, in the server's directory
Ok so what should i do than?
Should i rename the spigot 1.17 jar file to spigot.jar?
you do not need to worry about shading
no, that is not what it means
do not mind shading
Iyherfagdbskv
Okay so what is recommended than? Should i add the api-version to the plugin.yml or?
bump
none of the shading conversation applies to your project, as far as i know
did you ever show the errors from the ide
I did yes
This and the chatcolor one and the rest are similar to the chatcolor and bukkit one
have you removed the old spigot jar from the project's dependencies
and have you imported the class
Yes i have removed the old spigot.jar from the project.
I need to import a class that will have nothing in it??? I dont get it
What do you mean it has nothing in it?
Nope
me.wisdome.addon
what is the package of your project
He just said it
well
thats yoru class
I didnt make it i clicked "Create class" when i hovered over it
.........
hi?
yes, you told the IDE to make it. You made it
who use skript plz?
In this video, I talked about EVEN MORE Types of Programmers. There is NEVER enough.
nobody
"import"
i dont anymore
This isnt the channel for skript xD
Eclipse CTRL+SHIFT+O
Yeah when i import stuff it doesnt do anything
can you please stop sending random videos in here
then you don;t have spigot as a dependency
what are you doing to import it
its about programming
Ctrl shift + o
this is a channel for help with programming
I do ill show u
its not relevant, take it to #general
no one knows about programming in there
?
ehhh OneDrive
if you want help, then ask for help instead of sending videos, please
ew
so a server full of developers does not know anything about programming
Xd
take ur shit out of here
and blocked
LMAO
F
try manually adding import org.bukkit.ChatColor; to the import list instead
idrc im trying to beat retrooper anyway or was it someone else idk
Ok..
Ive restarted the ide yes.
Project menu -> clean
Idk how to do that sir.
see above
I did that and i still got the same errors
did you add the import manually?
Yes and i still got the errors
shows us a screenshot of the IDE with the manual import
by chance is this a maven project?
please SS yoru project structure (left pane expanded)
which i think is false, so it is probably a normal project
I dont mind importing stuff manually.
Kk
maven is optional in Eclipse
quick comment: i will be talking about naming conventions after we solve this
You might as well talk about it now if you want while we solve this because we might be here for a minute or two.
it definately doesn;t like your referenced library
i would rather we solve one thing at a time
Yeah so im trying to figure out how to fix this 🤷
remove it. put it somewhere thats NOT OneDrive and re add it
Okay
@manic crater if the paper-1.17.1.jar is from the paper website then it won't work; thats a paperclip jar not a server jar
oh true
need to run the server once then use the patched jar in the cache folder
Okay so should i get the spigot jar file than?
oh i see
I don;t build against paper so no idea on that
or use their api
that is probably the issue, actually
rather then the jar
Kk
well we did know prior
I mean how am i supposed to know that.
but i did not think about the paperclip thing
the jar you used is called paper lul
well, it says paper on the jar
Someone help me pls. (Im using Gson)
Code: https://paste.md-5.net/egidinenol.cs
When it isnt has Solo it works fine.
But when it has solo
Caused by: java.lang.IllegalStateException: Not a JSON Array: "[\"test\"]"
?bt run that
it will build spigot for you
Hi. Do you guys know if chunk loading / world gen is done async in the latest versions of minecraft / spigot?
I got it in BUT! Now im having an inventory related issue, xd
maven is much easier
i sort of want to try to fix dishy's project myself and add maven whilst doing it but that would be sort of difficult
Before I start checking isAsynchronous everywhere
unless the project has a github repository
all he has to do is right click his project and convert to maven
where do you mean
are you writing a ChunkGenerator?
i do not use eclipse anymore so i did not know
Alright, thanks
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Don't use the title anymore
Look at that
And time to spend another 2 days working on this project all day and night included. Sigh
Figured the issue out if the time is the same as another cooldown it makes them both on cooldown
then yoru query is bad, you shoudl only be fetching the relevant timer
sounds like you are pulling ALL timers for a player
you need a WHERE ... in the sql
I do
PreparedStatement psa = conn.prepareStatement("SELECT * FROM kitCooldown WHERE UUID = ? and Cooldown = ?");
cooldown is the name of it?
then no other timer should affect it
yea
your ResultSet should only have that one timer
but I changed the time on another kit and it worked fine
is move event a good idea to check players coords or no xd
Why not just get their location?
does your sql not require ``
I don't believe so
k
otherwise if it did I wouldn't even be getting a time
is the move event a good idea to check if a player passed a certain point :)
pretty sure SQL is case sensitive though, so and should be AND
Hm. Really depends on your use case and implementation. The event is really costly.
Could be let me try
i mean the event only runs 20 times a second
so its a little limited
nope
Dispatching events async can be called more often or no?
?
Per player
Referring to this
i mean its probs fine if your just checking location
Again: Depends on your implementation.
idk but it runs 20 times a second
Most events shoudl nto be triggered Async
And 1000 times/s with 50 users online (worst case)
Elgar what also happens is if I pick 1 kit the others go on cooldown too
the code they will activate may well not be async safe
so maybe it's not something with the time
no
count how many are in your ResultSet
use worldguard api if you need to check stuff like that
what about no worldguard lol
More of a question if dispatching it async would disregard the game ticking limitation. But I guess it would then.
i mean i think its pretty good if you need it for location stuff like what you want
i kinda just want to check if a player walked past a boundary teleport them back inside
but i dont want to use worldguard
4 it says
if your query was correct it shoudl only have 1
hm
each player should only have one entry per UUID and cooldown name in the table
because the cooldown is based upon the player UUID and the cooldowns name
so each player should only have one entry that matches their UUID and the cooldown called "kitPlatinum"
right
what im doing when I set their time is I delete them from the table and then insert them into it
Hi I would like to create an Euler angle for an amorstand which point to north (I've been googling this but ngl I didn't understand a thing about euler angles thanks wikipedia)
I've got this from a forum pointing to west but I can't manage to transform it to point to north 😒
armorStand.setHeadPose(armorStand.getHeadPose().add(0, -Math.atan2(location.getX(), location.getZ()) + Math.PI / 4, 0));
you need to setup your table so it uses a unique pair of UUID and cooldown
unique pair of uuid?
composite primary key of uuid and cooldown name
I wish there was a way to not see the code you're not working on on a class
I am compacting things as much as I can but it's still a lot of volume
I've collapsed them but they're still pretty long
I'm not
so what is it just ensures there aren't more than one value the same?
that's also what I've been doing lol
I mean fundamentally this class needs to have 28 fields for now and with getters and setters it just gets a bitch chunky which I dislike
it ensures there will only ever be one entry for a specific ID and LastName
and once I readd comments it will probably blow past 1000 lines
in your case that would be UUID,cooldown
no, this is a class which creates plugin entities
that means each player can only have one cooldown entry per cooldown name
and manages them
you have 3 columns, UUID, cooldown, time
4
lol
whats the 4th?
UUID, Player, Time, Cooldown
why player and uuid?
so I can see their name
why time and cooldown
cooldown is actually its name
name should belong in a table of its own
this table should describe cooldowns only
if you have teh players UUID you can easily get their name from OfflinePlayer
yea
and not needed as its in OfflinePlayer
I know that's why I have their uuid
yep, you only need 3 columns, and set the UUID and cooldown as unique constraint pair
ok ok
I will delete name
done
so should I use CONSTRAINT when getting their time or setting their time
well both
yes
you can have the pair as your primary key, which forms a composite key
🥲
CONSTRAINT P_COOLDOWN PRIMARY KEY (UUID,Cooldown)
now I should still delete them from the table correct
well it's an unnessecary write if the cooldown is a date
i'm guessing thats what it is?
varchar
he has a 3rd column for time
whatever the coluimn was called
Cooldown = name (String)
oh no it's bigint
and thats the date for when it expires?
the time type is bigint
yes
what are you talking about then
what do you write in that column
the time of the cooldown
as in the date it expires or the literal seconds left
i would suggest you store the date it expires instead
or the date the cooldown was applied
either works
from his code I believe it stores the current time in ms
yes it's in ms
so time the cooldown started
i mean you could delete it when it expires, but that imples you're constantly checking the database whcih does not sound like a good idea
I have it so when a new time for that cooldown is set it deletes it
i assumed you're just storing the time it expires and just comparing it
you don't need to delete it, you can just update the row
as in how to check if the player has a cooldown or not?
ChatColor.of(java.awt.Color)
like when I set their time first I check with CONSTRAINT then delete, then insert
just insert into ... on duplicate key update ... if you want to set the time
no need to delete the row just to reinsert it
how do you reinsert?
on duplicate key update is mean
Done. That felt good.
i'll see him in about 15 hours
lmao
I wonder how many alts the guy actually got
probably already in this channel right now 👀

Hullo
Hola webdev
nice
L
I made my code so modular I could literally copy and paste it into Java
It wouldn't work
But I could do it
hi
how you been
why you no work on HAC
i was gonna use that
Fuck you
You're asking stupid questions

Make chess 😄
Too much work
🤔
yes
No
Then you'll be asking me to make an anticheat for the minecraft I made in react

or just if(cheating) ban;
There are many layers of abstraction behind that cheating var
could someone help me with this
https://paste.md-5.net/tufuqodipu.java
what with it
they have comments in the paste
except with different activate methods, is there a way to store a list of these and call the activates of all of them?
this.checkCheats(); 😋
yeah
Storing a list of them, ArrayList; for having different activates I would just have an abstract void method that is called on the execution
Id use abstraction rather then what you are doing
could you give me an example, im not sure what abstraction is
ty
Rack you still work on that core?
How would I utilize custom sounds/music. I assume i'd need a resource pack?
yes
or do the website method
but that one is shit
so pack
so do you know how i could make a list of subclasses?
@eternal oxide ok so I added the CONSTRAINT
Gotchu. How would I point to a custom sound in a plugin? I'm trying to play a sound when a player enters a specific area.
My only idea would add them manually to a list; not of anything else but others might have an idea
Alright nice, what type of core was it now again lol
Just a general server core with essential features, chat management, disguise, punishments, with mongo and redis built in with performance being the #1 for my server whenever it releases
That server got a discord yet?
Danke
uhh
website better than pack
lol
much better
idk what u talking abt
ehh personally I prefer a pack
but I only do that if you really require a pack for a server
you're gonna have to load up a new pack everytime you play a new song
so adding the CONSTRAINT will that fix my issue ?
no?
Yes if its custom
1 pack
and you didnt add it in before
tons of songs
Just set the tunes to different songs
like pigstep = Song
but on a website u can do that easily
easier accessibility
swappable
and also more features
and better user interfaces in general for websites
pack better imo
r u trying to use like the noteblock api to make a spotify player?
Pack feels cumbersome
Exactly
^
oh ok, it kinda sounded like that
you have to wrap it over and over again
its all fun and games until they have to download a 2 gigabyte pack
yeah no
fuck that

thats gonna take long as hell
not with my 5grand net
idc lmfao
just because you have fast wifi doesnt mean that everyone else has that privelage
i used to be stuck at 15 megs download for my whole wifi
and 2 megs upload
I never said where I live. Might have spent way too much on it but I live in aus
sooooooooo
Kekw
ok
Sure
yes u can use Kotlin tho
woooaa cool
personally tho.. kotlin is fucking disgusting and i hate it
I haven't tried it out but i wanna see if its better
bruh
idk what java version ur using
maybe i just have to practice more
or what you even mean
Well kotlin got the upper hand in terms of features I guess
but java seems to work great for me
still dont know what u mean
coding is art. My pen feels very stiff and the ink is spotty and its not inspiring me
i wanna see if this other pen by a different brand is more appropriate for my hand
how can I make it so if a player dies to any cause, like another player killing them, or them dying to a natural cause like lava, or fall damage, they can keep this specific item? I've tried to search this up but i've had no luck in finding an answer.
use the PlayerDeathEvent
Yes it should fix your issue. You can only now have one cooldown for each player per type
your resultset should now only have a single entry
that is in your table create query yes?
yea