I just wrote a blog post about this with an improved approach, which uses a Filter instead of an Appender for this:
https://blog.jeff-media.com/how-to-read-or-block-spigots-console-output/
#help-development
1 messages · Page 574 of 1
from what ive seen it disables it instantly but lemme restart it just in case
Make sure to have every class start with an uppercase letter. Also I would recommend checking for any errors in console
(the lettering will not affect the plugin but its good practice)
it should give you a reason as to why its getting disabled
well i got something i didnt see before
?paste
Cannot invoke "com.enderelite.EndereliteMaster.getConfig()" because "this.plugin" is null
how do i fix that
initialize this.plugin
can you vc i share screen
where do you initialize EndereliteMaster plugin;
you only declared it
also dont use minecraft logger
public static EndereliteMaster plugin;
after public Mysql sql;
oh yeah i have translation problems
initializing means to give it a value
please just use paste for code
?paste
these txt files are annoying
those private variables are getting initialized probably before your constructor updates the plugin value
so just set those variables in your constructor
then you are sure its in the right order
so how do i fix that
i have made my mysql class run last in the list and it still giving same error
show updated code
What am I doing wrong here? I totally feel like Its something stupid. So basically I'm trying to run a task at a given time. I'm using my own custom scheduler for this (as it schedules in seconds / minutes and on another thread) https://paste.md-5.net/uqacuzukec.java
What i know so far is the task starts, but when the time runs nothing happens. The even doesn't trigger I've tried using sysouts that doesn't print. what am I missing?
you never set public static EndereliteMaster plugin;
when you create the instance of the mysql class, your host variable will try to get the plugin to get the hostname
but that happens before this.plugin is set
ah in addMisc
it is set in the main file
no sql class
show plugin.yml
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.
name: VDPsTreasureHunt
version: '${project.version}'
main: vaggelisdapro.vdpstreasurehunt.VDPsTreasureHunt
api-version: 1.19
commands:
getarmor: vaggelisdapro.vdpstreasurehunt.commands.commands
that's wrong
it should be like this:
commands:
getarmor:
permission: vaggelisdapro.vdpstreasurehunt.commands.commands
so that is all the help i get learn jarva
you clearly don't know the fundamentals
we can't really help you with spigot if you don 't know java
jackson, I literally told you what to do 3 times by now
Java != Python code order doesn't mean execution order
if those words I said dont mean anything to you, look it up or learn java
fields are initialized before your constructor is called.
all those classes work i am just struggeling with mysql
name: VDPsTreasureHunt
version: '${project.version}'
main: vaggelisdapro.vdpstreasurehunt.VDPsTreasureHunt
api-version: 1.19
commands:
getarmor:
description: .
usage: /getarmor
?
you don't need a description for your command iirc btw
you can also leave usage and description empty
commands:
getarmor:
this will also work
yes
oh-
.
does the task get stopped?
I mean this code looks like it should work right? That's kinda why I'm pulling my hair out rn
i got the code from a youtube tutorial and it worked for him
yes
In this video, I will show y'all how to connect to a MySQL Database! This is super useful for those who want to have multi-server data! I hope you all enjoy it!
Download XAMPP: https://www.apachefriends.org/download.html
Line of code:
connection = DriverManager.getConnection("jdbc:mysql://" +
host + ":" + port + "/" + database + "?useS...
oh no CodedRed
this code in isolation looks fine
okay so it must be something outside of this class thanks 👍 time to go dig throuhg my 200 classes and find the error!!!
i coded all my other cod my self and it works perfectly i am just trying to learn mysql
yes because he is using string literals or constants and doesnt depend on the plugin instance
your sql is fine
why is your plugin instance in your SQL class static
its just your class construction thats broken
that seems like such static abuse
also make sure you construct all your fields in your constructor
its kinda what constructors are for
that way you know your plugin won't be null
yes thats what I have tried to tell them for like 10 minutes
can someone plz edit the code or show me an example that is how i learn
you really should be working with raw java before spigot
lets start with the basics, do you know what a constructor is?
Hello, how can I use custom ChatColor ?
wdym by custom chat color
like you wanna make a hex
how a plugin class is laid out to retrive code in certen order
example : #ff9900 for an orange
not that easy iirc don't you need a parser
?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.
okay thanls
I seriously thought the format was still &x&f&9&0&0&0&0
no thats what it will get translated to
you can construct it using hex strings
im 120% sure since it works in my plugins
is bungee ChatColor convertible to text ? (or to spigot ChatColor)
it is text
you should never use spigot ChatColor anyways
okay thanks
its archaic
you do chatcolor.red + "bla" and it works
does anyone know how to remove these messages?
i only found code that removes some parts of it
change Mongo logging level https://www.mongodb.com/docs/manual/reference/method/db.setLogLevel/
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import org.slf4j.LoggerFactory;
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger rootLogger = loggerContext.getLogger("org.mongodb.driver");
rootLogger.setLevel(Level.OFF);
((LoggerContext) LoggerFactory.getILoggerFactory()).getLogger("org.mongodb.driver").setLevel(Level.ERROR);```
you could probably use log4j to retrieve mongo's logger as well
how can I hide myself too?
what
damn i loved this guy
if you're an online player you'll hide
but you can't hide yourself from yourself
not working
you cant hide from yourself
it works for other but how can I not be visible in f5
give urself invisibility
since thats not how it works
use invis potion?
with no particles
if I have armor on?
you can disable armor from packets
just go into spectator mode
lol
how
he has Autophobia
wait
log4j scary 👻
you can probably make yourself invisible from packets
0/10 would look at again
Does anyone know how to make boolean command ?
you check the args array, then you can either use Boolean.parseBoolean(String) or just check manually if the arg equalsIgnoreCase true or false
is this better as it6 now workes
I'm going travelling and not sure if I will have internet... With that said I wanted to create an offline copy of the docs so I can still work and access docs if needed. I tried following the guide on spigot website but I got stuck on running the command. I'm not sure what parts of the command to replace with filepaths, and what those filepaths I'm putting there should lead to. Any insight is greatly appreciated. https://www.spigotmc.org/wiki/creating-offline-javadoc-for-the-spigot-api/#wikiPage
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes
D: fields below the constructor
just download the javadocs from here, then unzip the .jar https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.20.1-R0.1-SNAPSHOT/
Does anyone know how I can implement chatgpt into spigot, using api
I doubt that you mean "implement"
that i would like to know about chatgpt
sure
RestAPI
use chatgpt's api*
thank you
I followed this as best as i could: https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
I still dont understand shit and this was a bit too complicated i think.
How do I get the plugin that called the event? (for my custom event)
I can just add a private final Plugin plugin and insert it into the constructor, but since registering a event listener needs to have a plugin passed to it I'm sure there is some sort of way.
wdym the plugin that called the event
Currently doing as such
public class PlayerJoinArenaEvent extends Event {
private final ArenaModel arenaModel;
private final Player player;
private final Plugin plugin;
public PlayerJoinArenaEvent(ArenaModel arenaModel,Player player,Plugin plugin) {
this.arenaModel = arenaModel;
this.player = player;
this.plugin = plugin;
}
@Override
public @NotNull HandlerList getHandlers() {
return null;
}
public ArenaModel getArenaModel() {
return arenaModel;
}
public Player getPlayer() {
return player;
}
public Plugin getPlugin() {
return plugin;
}
}
oh i get it
if chatgpt has an api I assume its like a standard rest api or whatever
Is this a fine approach or is there a more right solution?
Because I need a plugin object to register metadatavalue
public class ArenaJoinListener implements Listener {
@EventHandler
private void onArenaJoin(PlayerJoinArenaEvent playerJoinArenaEvent) {
ArenaModel arenaModel = playerJoinArenaEvent.getArenaModel();
Player joiningPlayer = playerJoinArenaEvent.getPlayer();
Plugin plugin = playerJoinArenaEvent.getPlugin();
joiningPlayer.setMetadata("locationBeforeArena", new FixedMetadataValue(plugin,joiningPlayer.getLocation()) );
joiningPlayer.setMetadata("currentArena", new FixedMetadataValue(plugin,arenaModel) );
String message = String.format("%s §ejoined the arena! (%d/2)",joiningPlayer.getName(),arenaModel.getCurrentPlayers().size() );
arenaModel.annunceMessage(message);
}
}
or I'll just handle that logic on the arenamanger class
I don't know where it's more correct to put that
That or I move the metadata lines to here, doing it this way:
public void teleportToArena(Player joiningPlayer,String arenaName ) {
if( this.arenaExists(arenaName) ) {
ArenaModel arenaModel = this.getArena(arenaName);
joiningPlayer.setMetadata("locationBeforeArena", new FixedMetadataValue(plugin,joiningPlayer.getLocation()) );
joiningPlayer.setMetadata("currentArena", new FixedMetadataValue(plugin,arenaModel) );
joiningPlayer.teleport(arenaModel.getLobbySpawn());
arenaModel.getCurrentPlayers().add(joiningPlayer.getUniqueId());
Bukkit.getServer().getPluginManager().callEvent(new PlayerJoinArenaEvent(arenaModel,joiningPlayer,plugin));
}
}
Maybe
teleportToArena should teleport the player to the arena, and do the FixedMetadata stuff
ArenaJoinListener should annunce the joining message and add the uuid of the player to the arena model player list (?)
I don't know if I split the logic or not
bro im trying to learn guis and my brain is fried 😭 i slept at 8am yesterday
pro tip: use a framework
like triumph
life saver
Like spigot guis or just guis in general
love it
is it for legacy
spigot
Lookat 7smile7 guide for modern guis
I believe it's 1.8.8+
I did i understood nothing
i couldnt find it
Upgrade your java knowledge frfr
Basically though InventoryHolder bad
Is all you need to know
dawg
i need something a lil more specific
I can help later I'm out rn
im making a xp converter gui so i put an item in on the left and get xp back on the right, idk how to do that efficiently
yeaah
custom items with custom durability
100 durability = 100 xp bottles
oh wait you were the one asking for the trade menu earlier right?
well
start small
start by opening an inventory with an item in it
that will send a message/print to console whenever you click on it
Items that are in the player's inventory and store MetaData will be resumed after a server restart?
alr made that
and then we'll talk
okay
then make it able to cancel the event if its in certain slots
I dont wanna make something inneficient or cause a dupe glitch cuz its for my server and im limited on time so even tho it will have bugs i dont want it to be too bad lmao
metadata im not sure, usually you use pdc if thats what you mean
well consider not doing it then because it aint gonna be super easy
what is pdc
its essential 🤷♂️
alr ill try and come back in a few hours with a bunch of bugs
Btw, use a wrapper like smile it makes life super easy
i tried but i dont understand anything so its better if i get to that point alone
ill reference it here and there tho
Example this is my inventory lib it's extremely lightweight
And is very similar to 7smile7s
im sure its good the issue is even tho the code works idk why it works
like idk why i need certain features etc.
Look at the source
i want to understand properly
you don't need most features in your case
yep
just go from what you already have
How do I do this? "No legacy enum constant for BLACK_STAINED_GLASS_PANE. Did you forget to define a modern (1.13+) api-version in your plugin.yml?"
Plugin yml:
main: me.Bamle.Main
name: Test
author: Bamle
version: 1.0
Put api-version: 1.13+
commands:
staffchat:
aliases: [sc, s]
usage: /staffchat
shop:
usage: /shop
fly:```
ItemStack glass = createItem(Material.BLACK_STAINED_GLASS_PANE, " ");
private static ItemStack createItem(Material material, String displayName) {
ItemStack itemStack = new ItemStack(material);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(displayName);
itemStack.setItemMeta(itemMeta);
return itemStack;
}
ops
noticed it now, thanks
No
1.8.9 + 1.12.2 + latest is enough
correction, 1.19 + latest is enough
No
Latest because latest, 1.8.9 because pvp was good then, 1.12.2 because it is the best for modding
Client forge, server spigot?
but since liek hald of teh community agrees with you, I will give you 1.8
Some things can only be done in mods. Others a plugin is much easier
Bukkit is basicly a modding api, for servers
wdym
And in general, keep forge 1.12.2 support up by keeping the 1.12.2 community up with spigot
well its just sad that mods wont grow to more recent updates
like
I know the game has terrible performance
but like
idk
i guess im ranting
90% of all mods either did a port that ruined the mod itself or just did not update
you mean ruined as in feature wise or ruined as in code wise
Feature
yeah
well thats poor decision making
well i prefer some modern mod textures compared to most older textures from older mods
my discord thinks 1.18+ is enough
yeah
i mean once you're past the 1.8.9 mark, the next best is latest from what I can tell
1.12.2
i dont know many servers on 1.12
but I dont really play a large variety of multiplayer servers often
I don't know any modpacks I like on 1.13+
well yeah
1.12.2 basicly half-died but its still by far the best
but I dont know why bukkit is relevant for forge mod packs
If more people play 1.12.2 bukkit, more people play 1.12.2 forge
I mean if you are just talking about minecraft versions in general, then I agree
well if it half died, how can it be the best
I indeed write all my modpacks for 1.12.2 only
Because things suck above that
It is impossible to make good expert packs in 1.13+
Also im maintaining a clientside 1.12.2 mod for a 1.12.2 server
but certainly harder lol
73% are on 1.19+
87% are on 1.16+
the remaining servers are on 1.12 or 1.8
Which is not even portable since chat reporting basicly lol
only if they would bypass it
do worlds with spaces work?
does yaml allow spaces in keys? Like
key with spaces: data
yes
sure
the quizbot on this server also uses very weird category files, where the question is an unquoted key name -> https://github.com/JEFF-Media-GbR/QuizBot2/blob/master/src/main/resources/categories/red/computers.yml

thats cursed
looks like a query error, show code
use prepared statements
that does'nt work too
and your database is valid?
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE housepurchase SET OWNER = ?, IS_OWNED = ?, IS_BUY = ? WHERE ID = ?");
preparedStatement.setString(1, player.getName());
preparedStatement.setBoolean(2, true);
preparedStatement.setBoolean(3, true);
preparedStatement.setInt(4, id);
System.out.println(preparedStatement.toString());
preparedStatement.execute();```
I tried that
yes she's valid
I can INSERT AND SELECT
you can only UPDATE on an existing record
Caused by: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Spectr2155e' in 'field list'
Here is my colums
I dont understand why he want to get a column named with my username
maybe broken sql request
Thats the print in console
com.mysql.jdbc.JDBC42PreparedStatement@13cbeb25: UPDATE housepurchase SET OWNER = 'Spectr2155e', IS_OWNED = 1, IS_BUY = 1 WHERE ID = 766016
When I type "/", a lot of commands are suggested for tabbing, how can I remove them? I tried with the TabCompleteEvent, but at that time the event is not triggered
do you have an id 766016?
no I do INSERT and that's work
but the error say that he doesn't know the column Spectr2155e I don't understand
can I insert value where is not empty ?
that error doesn;t match the sql satatement you are showing here. are you sure you are not also running some other quiery?
i need help
so
plants and bamboo don't grow on loaded chunks since 1.9
they only grow in area near online player
on loaded? you mean unloaded
loaded
So, can i create a "fake" player so crops will actually grow around him
the chunk is force loaded rn
but when i leave it, plants don't grow
you mean 1.19?
By force loaded do you mean you added a chunk ticket?
Since fake players are usually purely packet based since you can't do new Player() it isn't that easy
chunk.setForceLoaded(true);
the command block runs just fine
when i'm 99999 blocks away
and all redstone thing work
if i set it back to forceLoaded(false) everything just stops
just as it should
try a chunk ticket instead of forceloaded, not sure forceLoaded ticks them
ok
mobs do spawn
redstone works just fine
and command block commands
if i unload the chunk back, evetything stops, as it should
except fucking plants
they just don't grow until i decide to fly nearby
tho, when i change randomTickSpeed they grow faster(but when i fly away they stop growing, but everything else works fine)
Plants grow from random ticks which require a player nearby, don't they?
yeah
Yeah it does no longer work without players. You might do some hacky reflection to pretend there still is a player. Would have to dig deep into mojangs code though.
And if you are unlucky it's not a "one time load" boolean but an actual calculation per loaded chunk
I'll ask, does this also happen on Spigot as guaranteed you are running a fork?
and forceloading chunk doesn't help that
I didn't read the whole thread so idk
It does happen in vanilla
But yes, also spigot
so
i forgot how to take an argument for a class that extends another 🤦
can you give me some advice on how do i create a fake player
Class<GUIHandler> isnt gonna work cuz i dont need the class itself
I'm not really sure what you mean
Fake players are just packets usually
can you please provide some code
and do i have to do this remapping thing
and import nms
What I'm trying to say is: Packets are not stored on the server
fake player uses nms (usually) so changes every version
so a abstract handler class and another class that extends the handler
and then i have a hashmap of UUID, handlerclass (class that extends the handler lmao)
Therefore a fake player won't tick your chunk
np i only need 1.19.4
sheeeit
Can you do packers but instead of sending the to the client you force to think the server those packets have been sent from a client?
if it's only one version you can use an Entity fake player
that will tick your chunk as its seen as an actual player
Class<? extends GUIHandler> would this work? or would it return the class itself and not the contents inside if you know what i mean
so can you provide some code stuff
i'm too lazy to google
Guess I never heard of that. But isn't of use 99% of the time when working with NPCs😅
or at least links
private HashMap<UUID, GUIHandler> inventoriesByUUID = new HashMap<>();
this should work no?
oh wait i didnt save my file so
what are you doing
yeah it did work
you only need call nmsWorld.addNewPlayer to make it a server side player
i was trying to make a hashmap of a inventory uuid and a class that handles it but i had an error with registering the handler class, like i couldnt put uuid, this in the hashmap even tho the class extended guihandler
one sec I'll throw you some old test code I did. no longer works but woudl be simple fo ryou to update. It will show you how to do Fake players
is elgarl short for e-girl?
ElgarL is a really nice person
elgarl blushing rn
isn't there some 1-method solution to just spawn a fake player and forget about his existance
if you build one 😛
probably
NPCFactory.createNPC(loc.add(loc.getDirection().setY(0).normalize().multiply(4)), "ThisIsATest", NPCFactory.skin3);
thats called over abstracting
is that the part which creates a player
@eternal oxide
public static Npc createNPC(Location location, String name, @Nullable String[] skin, @Nullable Consumer<Npc> function){
DedicatedServer nmsServer = (DedicatedServer) NMSUtils.getDedicatedServer();
ServerLevel nmsWorld = (ServerLevel) NMSUtils.getServerLevel(location.getWorld());
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), name);
Npc npc = new Npc(nmsServer, nmsWorld, gameProfile, null);
if (skin != null)
npc.setSkin(skin);
spawn(npc, location, function);
return npc;
}```
there it is
no
private static void spawn(Npc npc, Location location, @Nullable Consumer<Npc> function) {
ServerLevel nmsWorld = (ServerLevel) NMSUtils.getServerLevel(location.getWorld());
npc.setPosRot(location);
if (function != null)
function.accept(npc);
nmsWorld.addNewPlayer(npc); // Add to world so we trigger Events in Bukkit.
showAll(npc);
}```
and there
As you require it to be seen as an actual player to grow yoru plants it has to be added to the world, this will cause messages to be sent to it. These will crash your server as there is no client attacherd
so what do i do
you have to prevent any packets being sent to teh fake player
I literally gave you all the code you need
so i need some code again
such are the woes of a programmer
@Override
public void send(Packet<?> packet) {
// Empty as we never want to try an send packets to a fake player.
}```
cool
?1.8
Too old! (Click the link to get the exact time)
damn right its too old
how would i get what type of interaction it is in InventoryClickEvent. like if a player is placing a block in or getting one out
cause i want to allow placing in curtain slots but not the others
can it bless me with some bitchs?
when i might consider
actually i found a work-around but i still need to get when a player places a block inside
getAction()
I bet there is an enum with all kind of inventory event actions stuff
these are all "placing" items
"Place some" nice
thanks
damn i have to check if any of these are true 😭
public boolean isPlaceAction(InventoryAction action) {
return action == InventoryAction.PLACE_ALL || action == InventoryAction.PLACE_ONE || action == InventoryAction.PLACE_SOME;
}
@EventHandler
public void onClick(InventoryClickEvent event) {
if(isPlaceAction(event.getAction()) {
event.setCancelled(true);
}
}
yeah thats what i did
if(placing && e.getSlot() == OUTPUT_SLOT_1 || placing && e.getSlot() == OUTPUT_SLOT_2);
now
im wondering if this would return true if either side are true
so if placing and slot is outputslot1 OR if placing and sot is outputslot2
right?
@tender shard
I'd just do it like this
if(placing) {
if(event.getSlot() == 1 || event.getSlot() == 2) {
...
np
if you have more than one slot, you could also use a Set or sth
private static final Set<Integer> PROHIBITED_SLOTS = Set.of(0,1,2,3,4,5,6,7,8);
public static boolean isProhibitedSlot(int slot) {
return PROHIBITED_SLOTS.contains(slot);
}
or with a switch/case or whatever
ive made a array of all the filler items, and then 1 slot for input by the player and 2 slot for output by the plugin, so basically a player trading items with console lol and i needed to prevent the player putting items in the output slot 👍
scoreboard not showing to a player
public void createScoreboardExp(Player player){
ScoreboardManager manager = Bukkit.getScoreboardManager();
assert manager != null;
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("expManager", "dummy", "Опыт");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = objective.getScore("Exp:");
score.setScore(1);
player.setScoreboard(board);
System.out.println("New scoreboard was created!");
}
func triggers when player joins to server
When jit is telling you it can code better
what is the best way to make delay?
is it ok to use Bukkit.getScheduler?
oh damn those method calls must becomes very hot then
yes runTask
ty
(61 bytes) callee is too large ah cmon 61 bytes too large to inline
jit only optimizes my constructor 💀
callee uses too much stack inline ah yes
My code is not working, i'm trying different things for a few hours now but nothing works.
It doesn't get the arraylist, so the selectedspell is null.
where
What do you mean?
spellManager.selectedSpells.get(player);
This is the begin of the problem.
That returns null.
for a start, use player UUID not the player object. The object does not persist between logins
Okay, i will do that later. Thanks for the tip 🙂
and dont expose collections
if it's returning null you havn;t put anything in it
holy, a simple integer increment
Hello, how can I make <Entity>#setCustomNameVisible(true); only visible for 1 player ?
plugin.data null
if this.data is null it means pluign.data is null when you create the instance of this class
fast as a ninja
🙂
got nothing better to do actually
this will not update data if you set this correctly after you already created this object
for that you just need to save a reference to your plugin
to get your updated plugin.data
which is 90% what you want
but the class still works this code still works
@EventHandler
public void onEntityExplode(final EntityExplodeEvent event) {
if (event.getEntity() instanceof Creeper) {
event.setCancelled(true);
}
}
that method doesn't access data
yeah ofc it will work then
data is null
so anything with data will fail
I mean
idk what else to tell you
visually?
ye
you mean like hotbar or inventory slots?
hotbar
not possible without a resourcepack
kk
Hello, how can I make <Entity>#setCustomNameVisible(true); only visible for 1 player ?
i'll prob just put like barriers on hotbar slots then except 2
and make it impossible to move
like this
you can code it so it works, but it will feel weird without it visually showing I guess
yeah that's what I was thinking lol
it's whatever ill try
packet magic most likely
you could fill the rest with bedrock to show its not interactable, but then that would also require extra logic you cant place it etc
yeah or barriers
imma just do that
didnt read wat you sent above
thank you that worked
not working
Does anyone know why this dosent work? i am notting getting any cooldown
cooldown.setCooldown(player, (Config.get().getInt("Cooldown")) * 60 * 1000, TimeUnit.MILLISECONDS);
are we supposed to know what that does
that will be in millis but it is ONLY millis, nothing to do with current time
?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.
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Minutes
why pass it as seconds when you can pass it as milliseconds
because his config entry would be messy
Pastebin
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.
?conventions
Also database on the main thread 💀
Anyways as the error says you have a syntax error in your sql
?
So what should i do to send the cooldown to the player?
why are you using a Boolean instead of a boolean? Why are you using Boolean.valueOf(true)? why are you casting a TextComponent to a BaseComponent? Why are you doing sql stuff on the main thread if you don't need that data right away?
line 34 typo
PreparedStatement ps2 = plugin.sql.getConnection().prepareStatement("INSERT IGNORE INFO enderelite" +"(NAME,UUID) VALUES (?,?)");
ive been stuck on a problem for like 10 mins and turns out i didnt register the event 💀
that's why the best debug method is to just spam debug output everywhere lol
what is the typo @eternal oxide
INTO
whats the enum name for colored dye legacy
1.8
Part 2 is here! In this video, I go in-depth explaining how to use info from the MySQL database! A longer video because I believe once you master this you can master anything :) I hope you all enjoy it.
Download XAMPP: https://www.apachefriends.org/download.html
SQL Info: https://www.w3schools.com/sql/sql_syntax.asp
Want more videos?
Become a ...
like what color do you want
it sais to use info not into
red, yellow, green, cactus
bruh
what
what name is it
INFO is not an sql keyword
what are the names
Shoule just be ink sac
With damage value
what is the damage value for each color
You can google that
one can never have enough debug output
thank you that fixed it
what if i were pulling it from a config, how would i also give the damage value
if I would be forced to use the shitty 1.8 API, I'd use XMaterial for stuff like dyes etc
what is xmaterial
👏 This 👏 is 👏 why 👏 you 👏 never 👏 copy 👏 paste 👏 from 👏 a 👏 tutorial 👏
Anyone?
i did not copy and paiseted i hand rote
oh wow
packet magic ?
🤣
anybody can explain please x)
which is like the same thing
okay
You wrote it, sure, but you have no idea what you wrote lol
The creator typo'd INFO instead of INTO but failed to rectify that at all anywhere in the video, which is a shame
if to add 1 point in a database is set what would it be to deduct is it remove
lmao what a great tutorial
reminds me of // Plugin shutdown logic comment that every second plugin has in their otherwise empty onDisable() method lol
hi guys can someone help me?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Can someone help me pls
dude
^
What?
read this
Ask the question and we will try to help
do you know java
No
?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.
then learn java beforehand ^
no
you need to learn basic java before you can do plugins
But I watch a 1 hour video and I learned nothing
but this is not the place to ask
check out one of the tutorials in the links above ^
^
Ok
It's going to take a lot longer than that to learn
ok:(
Programming isn't something you learn in a day much less 1 hour
wait can you mae a plugin and i wanna see it!
there are plenty of plugins on github you can look at
what is the enum material for piston 1.8
but i wanna make it myself
Start by learning basic Java
k
BASE right
Can someone help me?
We can't read your mind
I have tagged a message
i think they're using my Cooldown class from JeffLib
I am
Which contains almost no info
simple question, how expensive is UUID.random()?
Here
Im not getting the cooldown
cooldown.setCooldown(player, (Config.get().getInt("Cooldown")) * 60 * 1000, TimeUnit.MILLISECONDS);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player.hasPermission((Config.get().getString("Permission")))) {
if (!cooldown.hasCooldown(player)) {
cooldown.setCooldown(player, (Config.get().getInt("Cooldown")) * 60 * 1000, TimeUnit.MILLISECONDS);
player.setFoodLevel(20);
player.sendMessage("§7You got full hunger.");
} else {
if (cooldown.getCooldownRemaining(player, TimeUnit.MINUTES) >= 1){
player.sendMessage("§7You need to wait §f" + cooldown.getCooldownRemaining(player, TimeUnit.MINUTES) + " §7minutes and §f" + (cooldown.getCooldownRemaining(player, TimeUnit.SECONDS) - (cooldown.getCooldownRemaining(player, TimeUnit.MINUTES) * 60)) + " §7seconds.");
I assume its not that expensive but I wanna double check
Yeah it shouldn't be expensive
what's the full code? and why are you not using seconds or minutes or sth as timeunit? milliseconds seems pretty pointless here
okay thanks
btw that's not how it works, you cannot just do TimeUnit.MINUTES and then get the remaining part as seconds. you should only get the remaining cooldown in seconds, then calculate that into minutes and seconds yourself
if e.g. the remaining cooldown is 90 seconds, then getting it with minutes will return 1, and getting it with seconds will return 90
send your plugin.yml and your class structure
you could just do it like this
int minutesRemaining = secondsRemaining / 60;
secondsRemaining = secondsRemaining % 60;
morning alex 
hi
But the reason why i am doing this is becuase if it is 2 minutes and 34 seconds it sends
You need to wait 2 minutes and 34 seconds
Insted of You need to wait 2 minutes
or You need to wait 154 seconds
that means the main class declared in plugin.yml is not correct
oh did discord update their default profile pics?
where's the package declaration?
or am I seeing a coincidence
How are you compiling?
Are you using that intellij plugin or mc development?
does your .jar actually contain the class? open it with winrar or sth
it has
using plugin
gthandcuffs != testhand
oh lol
prolly got the groupid different in your pom
where tf does gthandcuffs come from lmao
try ctrl + f and search for that word?
💀
what in tarnation
when you change stuff is it possible to have intellij show you all the errors you created. For example I just added to a constructor, but no errors pop up right away so I have to manually look around and its annoying asf
i just compile and use mavens jump to source feature
right click maven error -> jump to source
honestly still not sure if my workflow on vsc is just better than intellij
ive never used it for any compiled languages ive always used it for like javascript or similar
I mean vsc is just an ide at this point
my only issue with vsc is MS requiring me to regularly log in to use it
how so
I use VSCodium
so its open source
im too used to intellij's keybinds at this point to switch tbh
I dont have to log in anywhere xD
how I was with vscode I spent 2 hours changing hotkeys because I edit mine for vsc too
yeah i cba for all that lmao
if its MS VSC and you don;t log in for a bit they expire your license
maybe he is talking about Visual Studio? Visual Studio sucks ass
do you mean visual studio or visual studio code?
they need to make the 2 more distinct in difference
because names are too similar for 2 totally seperate things
is there a difference? I've hardly ever used it
ik its annoying
yes Visual Studio is widely considered shit by most people I believe
well vs code is a beefed up text editor
my bad then I'm refering to VS
and vs is a crappy over engineerd ide that works about 75% of teh time
how to make it so that the entity cannot push the player?
setCollidable is a method iirc
its def not great for gui's because there is no built in Swing editor or JavaFX editor, but otherwise i'd say its a solid choice
thx
all those GUI editors are such a pain anyway, I usually just write gridbag layouts through code, imho that's easier and faster
okay maybe its not hmmm
it's on LivingEntity
I just like the GUI editors because I know how it'll look and I don't start it up to look at it 10000 times
Gridbag is nice but being able to plop stuff almost anywhere is great
so I need to use it?
why is Material.BREWING_STAND invalid
yeah should be accesible directly from Player if not just cast it to LiivingEntity
version?
then the way its getting put into your GUI is likely wrong
In 1.8?
ye
Ink sac with some silly meta value
yeah ink sack 16 doesnt work even tho its meant to be 16
make sure to set the damage, its not called meta deta directly
16?
oh maybe its 15
There should only be damage values from 0-15
why don't you just check the javadocs
send them
BREWING_STAND is the block, BREWING_STAND_ITEM is the item
oh
yeah in 1.13+ almost all items and blocks are the same material
actually?
ah
if I need random UUIDs, I usually just generate a few hundreds in onEnable() and then reuse them later
I just want to overlap
custom impl
yeah a pool could work
Whats the difference between random and securerandom?
or just throw a few longs made by ThreadLocalRandom into the UUID constructor
dont pool it lol
ngl smart and when one gets used you can have aasync task that auto replenishes
SecureRandom is not as predictable

its for inventories so I guess I could instead use the slot instead of some arbitrary id
How expensive is namedUUIDFromBytes
How do you predict literal randomness?
Random is not random, same seed = same result
computers are predictable believe it or not if you have the right information
I believe big cryptography companies use stuff like lava lamps
SecureRandom is also seed based
yeah boi, my rng is hooked up to a lava lamp 😎
A full wall of them actually
Hmm, can't you do some weird stuff with using a seed to get some semi-random bytes from the computer and then combine that with the current timestamp or something?
I mean
u have shit that uses atoms
and shit that uses hardware, or mouse movement etc
yeah but it uses a more complicated way to generate it's seed than just using currentTimeMillis or sth lol
yep
Just take all possible factors and do make it random as possible
I must know what the entropy source is
self seeding 
Does every CPU have a small ant on meth for sourcing entropy
If not they should consider it
Like add the color value of each pixel to each other, add the brightness, use that as a seed to generate a number with the usual random, then multiply the previous result by that random number and you have some random random number
sounds expensive
nvm I can just use a counter value xD
im not gonna need more than MAX_VALUE anyways lmao
We should make the most expensibe random random
public static UUID randomUUID() {
var random = new Object() {
static RandomGenerator instance = new SplittableRandom();
};
byte[] randomBytes = new byte[16];
random.instance.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set to version 4 */
randomBytes[8] &= 0x3f; /* clear variant */
randomBytes[8] |= 0x80; /* set to IETF variant */
return new UUID(randomBytes);
}
@pseudo hazel
uses a normal splittable random instead
whats the diff
okay
well like I said I think a counter is easier for my implementation
thansk for the help
imma use that in musepluse
yea
all i know is that macOS uses fortuna for /dev/random and urandom lol
So no meth ants
nvidia?
amd
lol nvidia crads break on me like this all the time
only stopped breaking after switching to linux ironically
so, how can I make entity not Collideable?
chickens are always living entities
i remade it
yeh just that is fine
all entities are OPs lol
All mobs are
WTF
Entities can run commands
i was just making a joke damn lmfao
Via /execute
it's because they are commandsenders (/execute @e[...])
didnt know they were actually ops lmfao
oop 🤮
so theoretically i can make chickens ban people...
Honestly thats amazing
but why does it keep pushing me?
we need a public server that's secretly owned by a chicken
Isn’t there like an addCollidableExemption
so what should i do?
are you trying to lead players 💀 this feels like some prison system hahaha
You could try setting the player to non collidable as well maybe
I did this initially, it doesn't work.
there's getCollidableExemptions (where one can just add another UUID) but that just does the same as setCollidable(boolean)
?
does this problem have no solution?
most people would use packets for somethin like this tbf
@EventHandler
public void kitClick(InventoryClickEvent e) {
System.out.println(i.getContents());
if (e.getInventory() == i) {
e.setCancelled(true);
}
}
The sout statement works but the event isnt cancelled
could be wrong but == might not be the same memory address?
EntityChicken entityChicken = ((CraftChicken) chicken).getHandle();
PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(entityChicken.getId(), new Vec3D(0, 0, 0));
entityPlayer.playerConnection.sendPacket(velocityPacket);
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entityChicken.getId(), entityChicken.getDataWatcher(), true);
entityPlayer.playerConnection.sendPacket(metadataPacket);``` chat gpt gave me that
then the inventory is not == i
I need to send this packet each tick, or just it use one time?
what even is "i"?
.equals?
== is fine, it's simply not the same inventory
as I asked earlier - what even is "i"?
i changed == to .equals an it works
Inventory object
why does .equals work but == doesnt
.equals returns this == obj
.equals compares content and other features while == compares strictly the memory address
i is not the same as inventory
so therefore it shouldn't be cancelled
for inventories, equals is the same as ==, as it just calls the underlying NMS inventory's equals method, which isn't declared -> Object.equals()
== doesn't call the nms method though so what is the nms version
oh so thats why like for example playerjoinevent you cant do e.getPlayer.getName() == you must use .equals
which NMS method? it calls NMSINventory#equals() and that doesn't exist, it's the Object#equals() method
why cant i ss
Usage: !verify <forums username>
iv never been on forums
i can still type in this discord?
i have a .yml file but its called paper-plugin.yml
Inventory#equals() is just == with extra steps
and its not detecting ti
you need a plugin.yml file
not a paper-plugin.yml file
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
if (!(e.getItem().getItemMeta() == stick.getItemMeta())) return;
if(!p.hasPermission("bamle.stick")) return;
p.sendMessage("Test");
}
Why doesn't this work?
because you probably used the "MC dev plugin" and clicked on "paper plugin" instead of "spigot plugin"
LIGHT THEME
light theme, for bright people
that isnt the right way to compare items
i do want paper, i heard paper is just a 2nd version of spigot
stack.isSimilar(otherStack)
I live in darkness
the general idea is, if you code something for spigot, it will 99% work in paper doo.
if you code for paper, it only works on paper
rename your paper-plugin.yml to plugin.yml
spigot plugnis work on paper, paper plugins dont work on spigot
my ide doesnt allow it.
weak
how is there 15+ options
alright, still doesn't work tho
why are you using a ide you aren't familiar with
or umschalt if you're a lawyer
u can change it
