#help-development
1 messages · Page 1353 of 1
when i shutdown the server
to compile your jar from target sources (and generate if necessary)
pulse just help him ok thanks bye
public void onCommand(PlayerCommandPreprocessEvent e) {
if(e.getPlayer().getWorld().getName() == "Lobby") {
}
}
}``` How do I check If the actual command that the player is using is "/hub" to cancel the event
can u help int #help-server
nope im just not going to bother to help anyone at all
lol
dont like being flooded
@rapid vigil grab the message, it will contain the command plus the / in it
Why pre process?
please lmao
@eternal oxide could be a command of another plugin
No
oh i think i did it :)
I made the command /hub
Just makign sure its the right path to go down
and in the same time I don't want people to be able to use it in the world Lobby
@eternal oxide looks like you are right lmao
ok, not the right path
wdym
You don't need to do that
hey i want to ask how do i reduce the 20mb size of my plugin when using maven bcz maven like imports every file i use
oh okay,
you add yoru command to your plugin.yml, then register it in code.
you created the command, which means you can check where it is being ran from
that way it will ONLY run your code when its your command
I can make the command run in a specific worlds from the plugin.yml?
I think shading can reduce the file size. idk, i don't use maven
you assign a permission to the command
bump
whats that?
a...guys, the console is giving me this error: Fatal error trying to convert blahPlugin v0.1:me/f1nndev/blahblah/blabla.class org.bukkit.plugin.AuthorNagException: No legacy enum constant for MAGENTA_STAINED_GLASS. Did you forget to define a modern (1.13+) api-version in your plugin.yml?
how do i fix this?
if the plugin is only intended for you, then yes
the correct way is to use permissions
try api-version: 1.13 in plugin.yml
Just nevermind, I found out the answer, I was just too stupid, Thanks for help..
like this: api-version: '1.13' or like u said?
as i said
k
only way you are going to be able to do that is by removing things that are not needed in the plugin. Do you shade stuff into it?
idk what is shade
so your plugin is legitimately 20mb from all the stuff you coded?
You tried the IRegistry or using the PDC
lmao
oh okay
A 20mb java project contains years worth of code
that is why I asked lol
its not common to have a java project purely itself be 20mb
what's wrong with this if statement? ```java
if(interact.getPlayer().getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase("§6§lMenu")
A lot
why
this is my method: ```java
@EventHandler
public boolean onPlayerUse(PlayerInteractEvent interact){
if (interact.getAction() == Action.LEFT_CLICK_AIR || interact.getAction() == Action.RIGHT_CLICK_AIR) {
if(interact.getPlayer().getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase("§6§lMenu")) {
interact.setCancelled(true);
interact.getPlayer().openInventory(menuJogos);
}
}
return true;
}
Take it slow. You should create about 4 new variables and clear all warnings (mostly null checks)
@quaint mantle your issue is the jar plugin which can do a type of shading. It is always good practice to ensure all your dependencies have a scope tag on them to prevent accidental shading
second, most of those plugins don't need to be defined at all
i ignore all warnings lol
jar plugin?
oh it was there by default
you can pretty much remove all those plugins if you don't use them
in the <build>?
it is only necessary to define them if you want to use them and if you have configurations set for them
what is the an <scope>provided</scope>M
How can I code an admin gui(when you click on a players head it gives you options for what to do with the player)? i know how to make an interactive menu and how to make a playerhead appear in the menu, but i dont know how to make a menu for the clicked player
it means the project won't attempt to shade it into the final jar
That is not the way to go. If you fix all warnings you will remove 95% of all NullpointerExceptions
Cleaner Example:
@EventHandler
public void onPlayerUse(final PlayerInteractEvent event) {
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR) {
return;
}
final Player player = event.getPlayer();
final ItemStack mainHandItem = player.getInventory().getItemInMainHand();
final ItemMeta meta = mainHandItem.getItemMeta();
if (meta == null) {
return;
}
if (!meta.hasDisplayName()) {
return;
}
if (meta.getDisplayName().equals("§6§lMenu")) {
event.setCancelled(true);
event.getPlayer().openInventory(menuJogos);
}
}
and assumes it will be provided later
What final means?
Doesnt really matter in this case.
It just means that the variable cant be assigned a new value.
oh, like a const?
Right
whats <scope> values?
you have test, system, compile and provided
ty
compile means the dependency should be compiled into the project AKA shaded. but the tags are useless unless you specify certain plugins to be used by maven.
so should i use <scope>provided</scope> for spigot-api?
yes because spigot-api is already part of the spigot server
okay
You can easily answer that yourself. Do you think it will be available on the server your plugin is running?
im sorry im just beginning with maven
Anything that might not possibly be provided and isn't already a plugin as well should be something you should shade into your plugin and if you are going to do shading it is always best to do relocation on shaded artifacts.
This prevents conflicts with dependencies your plugin relies on, but some other plugin might also have(and didn't properly relocate such things themselves) or the user might be able to provide later. IE you shade another plugin into your project, but that plugin can be provided by the user.
okay but like if i remove the spigot apis the size will drop to 8mb from 20mb
how do i fix that
i used the an provided scope tag
You don;t fix it. That is correct
8mb sounds a whole lot better then 20mb XD
yea but i need those mavens bcz then the plugin will not work without it
Hi, I have a problem with a plugin I wrote. It is designed to give the player an axe when entering the game. This is not happening. The plugin works with all other items except axes.
@EventHandler
public static void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
ItemStack item = new ItemStack(Material.GOLDEN_AXE);
player.getInventory().addItem(item);
}
ERROR: https://imgur.com/a/FnFrVC7
You only set a scope. You still have access to everything, its just not included in the final jar
and that scope should be provided rightM
yes
and what about the warning that say that a method is never used?
for spigot-api yes
you have a bad item
however some of your dependencies is questionable and something we can't fully answer. So that is something you are going to have to determine with all the dependencies you have defined
okay thank you
wait
what?
golden axe doesnt exists
so how can i give this item to player
in Material. there isnt golden axe possible
as it says
what version u using
1.12.2
I was using 1.14.4, but I changed it to this
use GOLD_AXE
How would you generate a method when an annotation is applied?
when I use Material.IRON_SHOVEL it normally gives a shovel, it doesn't work only with axes
try use GOLD_AXE
Cannot resolve symbol 'GOLD_AXE'
Normally you have a plugin tied to the build process that reads annotations and does this for you @weary geyser unless you are making your own annotation processor? o.O
u are using only GOLD_AXE and not Material.GOLD_AXE
It means that you never call that method. If you download the MCDev plugin for IntelliJ then those warnings get automatically suppressed for eventhandler and command methods.
If this warning is not shown by an eventhandler or command method and its not part of an API you want to expose then it means the whole method is useless because you never call it.
well, the problem disappeared when I uploaded the spigot version again. Thanks a lot for your help! ❤️
okay
Hey I'm trying to make particles when a player moves but it isn't working. Here's the code:
package Listeners;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
public class OwnerParticleTrail implements Listener {
public void onPlayerMove(PlayerMoveEvent e){
Player p = e.getPlayer();
if(p.hasPermission("wolfpvp.owner")){
if (!e.getFrom().getBlock().equals(e.getTo().getBlock())){
World world = p.getWorld();
world.spawnParticle(Particle.HEART, e.getFrom(), 3, 0, 0.5, 0);
}
}
}
}
k ty
I also have the perms
lmao
add this before the public void
Poggers it works
xD basic error
Yeah I need to get better at this stuff lmao
ahh dont worry i also forget sometimes
Thanks guys
youre welcome
if (meta.getDisplayName().equals("§6§lMenu")) {
event.setCancelled(true);
event.getPlayer().openInventory(menuJogos);
}
this keeps not opening my menu
try this
if (meta.getDisplayName().equals("§6§lMenu")) {
event.getPlayer().openInventory(menuJogos);
event.setCancelled(true);
}
are you using the InventoryClickEvent?
playerInteractEvent
show the full code
?paste
in the main method use getServer().getPluginManager().registerEvents(this, this); instead of Bukkit.getServer().getPluginManager().registerEvents(this, this);
essentially does the same thing
they call the same stuff
only difference is one uses the Static method and your suggestion uses the plugin instance instead
but it was registering correctly
well yea but why use bukkit in the getserver
cuz forums said XD
I just stated the difference
they both do the same thing, one is static and the other way isn't
im sorry what
static method is needed in some cases but not always, but doesn't really matter which is used
well yea
@kindred solar put a sysout just before you attempt to open the inventory to see if your code gets that far
@kindred solar try using final ItemStack mainHandItem = player.getInventory().getItemInHand();
it only dont enters in the if statement
you tried to get mainhand item and not item in hand
it doesn;t enter teh last if check?
so its failing on the name match?
no
he used different item
he tried to use the main item in hand not get item in hand
his hand code is fine
i mean it works for me
yes but the name is the same, i already tried to send the name of the object i was clicking in the game and it said "Menu" with orange bold
use stripColorCodes and then check
The string you are passing is not encoded for color so it will not match
wdym
what server version u using
§6§l are characters that get encoded to orange and bold, but they don;t look like that when encoded
1.15.5?
the string you are getting from your item is probably already encoded
@kindred solar you should use the api methods to apply colors to certain things. It is bad to use the super script symbol directly and causes problems most of the time.
so how can i use strip color codes? never did that
Either strip colors or encode your string to compare
be easier to just strip the color codes there is an api method for that
ChatColor.
declaration: package: org.bukkit, enum: ChatColor
so ChatColor.stripColor(meta.getDisplayName()).equals("Menu")
What I usually do is make a custom Inventory class and check if the inventory is an instance of that class
Well they are on the part of checking for specific item
and if that specific item is used, it opens the custom inventory
ohh
wdym, im new at bukkit lol
I gave you the code to use
One thing at a time. Does it work now?
What they were talking about is when you want to ensure the inventory being used is indeed the custom inventory and not some other inventory
but that isn't your problem at the moment though
yess
ah k
why does this cancel the event? i cant manipulate the players inventories as a normal chest?
if (!(sender instanceof Player)) {
sender.sendMessage("You can't run this command in the console!");
return true;
}
Player player = (Player) sender;
if(CheckPermission.checkPerm("essentials.invsee",player)){
if(args.length == 0){
player.sendMessage("To use this command, run: invsee [Player]");
}
else{
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
Inventory targetInv = targetPlayer.getInventory();
player.openInventory(targetInv);
}
}```
you could do the reverse and instead encode your string to test ChatColor.translateAlternate
normally i would make an event listener to cancel the event
but in this case it cancels it self?
this Player target = Bukkit.getPlayer(args[0].trim()); int id = Integer.parseInt(args[1]); int amount = Integer.parseInt(args[2]); ItemStack item = new ItemStack(id,amount); target.getInventory().remove(item); target.updateInventory();
is the closest thing i found
i ill stay as u said for now xD
this isn't an event?
but i dont want to make it with a command, i want to edit it irl
its a command
then why call it an event
because then you move the players itemstack then you have an event
but only opening it is not an event
what i mean is, i can open the inv of the player, but i cant edit the item stacks in it
I c
Hey does anyone know why titles are not showing on lunar client ?
It's working well on the Minecraft launcher (1.8.8)
IChatBaseComponent chatTitle = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + "Ayyy test" + "\",color:" + ChatColor.GOLD.name().toLowerCase() + "}");
PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, chatTitle,20,80,20);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
why packets
maybe dumb question, but how would i listen to a logger? lol, never used loggers before that much, only used like Logger.log() and thats it lol
I'm trying to use a compass for my lobby compass but everytime I right click it teleports me. How do I get rid of it
in a worldedit config
Brb
set navigation-wand.max-distance to 0
Thanks
or -1 it should work both ways
It worked!
nice xD
would anyone know why my schematics arent pasting when using the fawe api? i have the right file and everything, but when i run the method to paste it nothing happens. no errors, no nothing. just not pasting. https://paste.md-5.net/daxixoxaqu.java is my code for pasting the schematic.
guys, how do i fix this warning? 'ItemStack(org.bukkit.Material, int, short)' is deprecated
Use the correct one https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemStack.html
Hi! I would like to check if a player inventory is completely empty, but I am not finding the proper way to do it since checking for null on each ItemStack is not working . Any advise?
what's the method to dont let the player change the slot of an item in the inventory that i created? isnt it event.setCancelled(true); ?
check for every slot if it's empty
InventoryClickEvent
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/Inventory.html#isEmpty()
@earnest fractal
declaration: package: org.bukkit.inventory, interface: Inventory
I see you noticed 😉
I was distracted 🙂
ah lol there's even a isEmpty method lol, nvm
and even if there wasn't
there is a getContents() method which gives you an array
which you simply could check if that was empty
i had in mind that i had to check for like every slot... idk why tho
That used to be the case long time ago
Whats a good api for making a inventory (gui)?
like 1.5 versions time
lol
inventorygui from luckos helper is great
On GH or spigot website?
There is actually quite a lot
just going to have to go through them and pick the one you like
i use it, its really good
overall, creating your own GUI though isn't all that difficult
yea, just annoying to make things like auto updating guis
(ones that read from variables and update when you clcik it)
Oh
omg, idk what is but i think bukkit doesnt want to me to program it, at few minutes this code was working, now isnt anymore
@EventHandler
public void onPlayerUse(PlayerInteractEvent event) {
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR) {
return;
}
final Player player = event.getPlayer();
final ItemStack mainHandItem = player.getInventory().getItemInOffHand();
final ItemMeta meta = mainHandItem.getItemMeta();
if (meta == null) {
return;
}
if (!meta.hasDisplayName()) {
return;
}
if (ChatColor.stripColor(meta.getDisplayName()).equals("Menu")) {
event.getPlayer().openInventory(menuJogos);
}
}
where is the item you want to click located ?
in the hand
getItemInOffHand()
you changed it from Main hand to Off hand
no?
main hand wasnt working
main hand is what was working
which version u using
1.16.5
okay lemme try
nvm
guys
im dumb
it wasnt working on main hand so i changed to off hand and i tried in the other hand and its working
how do i check the name of the inventory in "InventoryClickEvent"?
getView()#
doesnt exist
event.getView().
ah k ty
name is under that
but my inventory has a name with a color, is there any problem?
strip colors or translate
im making this if
if(ChatColor.stripColor(event.getView().getTitle().equals("Modos de jogo!")))
) in the wrong place
nvm
delete one from the end and put it after getTitle()
Is there an other way ? I checked on the web, found one guy doing it differently, using player#spigot#sendMessage, but can't manage to make it work, But splitting the PacketPlayOutTitle in 2 object, one with the length and the other with the title actually works 😄
player.sendTitle i think ?
He is on the ancient version. So he has do do some packet stuff for the most simple tasks.
The ancient version LOL
If people would learn to read stack traces and fix all warnings their IDE gives them then we would have 95% less of: "Plz Help" + plonks down NPE
he has on 1.8 right ? i'm using too, but exist that method
sorry
imposterManhuntListener class line 56
Pls post the method that contains this line
ok
CompassMeta cm = (CompassMeta) e.getPlayer().getInventory().getItemInMainHand().getItemMeta();
cm.setDisplayName(ChatColor.GREEN + "Tracking Compass");
cm.setLore(Main.getInstance().lore);
cm.setLodestoneTracked(false);
cm.setLodestone(playerTracked.getLocation());
e.getPlayer().getInventory().getItemInMainHand().setItemMeta(cm);
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Tracking: " + playerTracked.getDisplayName() + ", Distance: " + Math.round(locationDistances.get(playerTracked))));
its the first line
And pls rename your class from imposterManhuntListener to ImposterManhuntListener
Its nice that your class name is so expressive but also follow the Java naming convention.
ok
btw i checked if their holding a compass in their main hand
so idk why it won't work
Pls post the method that contains this line
err
...
I was confused with all the Main 🙂
Im still deciding if i want to read it or just tell you to extract that code into at least 4 more methods...
sorry, ik my code isn't that good
this test is going to fail bad java if (e.getPlayer() == Main.getInstance().imposter && e.getPlayer().getInventory().getItemInMainHand() == Main.getInstance().blindnessStick && e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
should i separate it into multiple if statements?
the last two tests shoudl be in ()
ok
Hello, I was wondering how I would go about getting a custom plug-in developed for my server
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
just finished doing this
ok
um, honestly I'd rewrite the whole thing. Sorry but thats my opinion 😦
screw it imma delete it
ok, first a few suggestions.
Don;t store player object, store their UUID (getUniqueId)
This is how a clean up could look like:
private boolean isBlindessStick(ItemStack itemStack) {
return Main.getInstance().blindnessStick.equals(itemStack);
}
@EventHandler
public void onPlayerInteract(final PlayerInteractEvent event) {
Main plugin = Main.getInstance();
Player player = event.getPlayer();
ItemStack playerHandItem = player.getInventory().getItemInMainHand();
if (!plugin.isImposterActive() || !isBlindessStickSet()) {
return;
}
... and so on
Take it slow. Create new variables. Return early. Create new methods. Never exceed the line limit. And dont ever use single character variables like 'e' or 'p'
I actually tested that before posting my message, got an "no such method" error, but I just retried it and it seems to work mb, even though it's marked as deprecated 😒
wait, how lmao
that's cool
wth, how?
is it when you upload a file?
Discord added a feature where you can upload .java files to discord and it will do that ^
yes
does it work with other languages like .... .py?
nice
ah, it would be nice if they added that to `` 1java
guys, how do i teleport a player to a specific location?
and what do i put inside this -> ()?
Cannot resolve method 'teleport(java.lang.String, int, int, int)'
is it good to make a class abstract to get its "Instance" i have more methods in this class.
?jd use the search function top right for teleport
package index
javadocs are your friend
Location location = new Location(player.getworld(), 0, 0, 0);
player.teleport(location);
@kindred solar
try that
you'll suffocate, but it would work 🙂
but i want to teleport the player to another world
feed it the correct world then
Bukkit.getWorld(namehere)
ah k ty
Then for player.getworld set that the world you want to teleport them so Bukkit.getWorld(world)
or player.teleport(Bukkit.getWorld("worldname").getSpawnLocation());
^ That also works.
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.
Show what you have got so far
no
public class GameWindow extends JFrame {
public GameWindow(MainWindow mainWindow) {
setName("2v2 Fight");
var button = new JButton("Exit");
Dimension dimension = new Dimension(40, 40);
button.setPreferredSize(dimension);
button.setMaximumSize(dimension);
button.addActionListener(e -> {
mainWindow.setVisible(true);
setVisible(false);
});
add(button);
setSize(600, 600);
}
}
its not making the button any size
it keeps matching the window size
your frame probably needs a layout
Ok then not lol...
Player player = thisistheeventinstance.getPlayer();
player.sendMessage(ChatColor.DarkOrange + "hello");
that doesnt work lol
Dont just throw in a component in your frame. Create a new JPanel, give it a proper layout like BorderLayout then add the panel to the frame and the button to the panel.
ok so player.sendMessage("hello" + ChatColor.DarkOrange);
so I put the string before now
so it can process
but i want it to say hello
player.sendMessage(ChatColor.GOLD + "Text");
Or do you want to use hex colors?
not nothing
thats what I did before
player.sendMessage("" + ChatColor.DarkOrange + "hello");
ohhhhhhhhhhhhhhhhhhh
Huh? I dont think the concatenation order matters.
Lets see if he reports it as working 😉
this is why
Thats not spigots fault. Minecraft just has those colors.
By now you can use hex colors.
I prefer craftbukkit over spigot
if they were smart enough they could have added more
CB is in Spigot
i'm pretty sure htey are two different companies elgar
there is bukkit company and there is spigot company
and they are like rivals
I think
nope
No. The colors are hard coded in older versions. The client has no way of showing arbitrary text colors.
And craftbukkit is maintained by the Spigot team. Bukkit is dead.
why did it die
thats very sad
its so good
like you can do so much stuff (besides color 😠 )
Several reasons.
You can do all that and a lot more using Spigot.
Spigot provides the whole craftbukkit API
as for the concatenation thing. If you don't start with a string it attempts to serialize the object
Makes no sense to me. Concatenation is a pure Java thing.
This:
public class SandboxCore {
public static void main(String[] args) {
String concat = SomeEnum.WEST + " some other Text";
System.out.println(concat);
System.out.println(SomeEnum.NORTH + " Some more Text");
}
public enum SomeEnum {
NORTH,
SOUTH,
EAST,
WEST;
@Override
public String toString() {
System.out.println("CALL");
return super.toString().toLowerCase();
}
}
}
Results in:
CALL
west some other Text
CALL
north Some more Text
Process finished with exit code 0
yep, try it with Chatcolor and Spigot
ChatColor#toString just returns the '§' char plus the colors number.
There is no other magic that intervenes with normal Java String concatenation
I definitely remember this being an issue, I don't remember when though.
@Override
public void onEnable() {
final String welcome = ChatColor.AQUA + "Hello";
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
event.getPlayer().sendMessage(welcome);
event.getPlayer().sendMessage(ChatColor.GOLD + "More Hi");
}
}, this);
}
I guess I'm wrong. One of those mandella effect moments I suppose
I get you
Is entitytarget event bugged for the newer mobs like hoglins & zoglins?
Im cancelling it, it cancels at first, but if i hit the mob he still starts targeting me
some1 help me plz, when a player joins im getting this error: Could not pass event PlayerJoinEvent to blahPlugin v0.1 org.bukkit.event.EventException: null
no other mob does that
EventException: null <<
Check the line the NPE points you to and make sure nothing in there has a warning "could be null"
So more null checks
it is happening cuz i added this lines : ```java
Location lobby = new Location(Bukkit.getWorld("lobby"), -164, 83, -257);
player.teleport(lobby);
@EventHandler
public void onWrongTarget(EntityTargetLivingEntityEvent e) {
if (main.getConfig().getBoolean("hostile-mobs-attack") == false) {
if (e.getEntity() instanceof Hoglin) {
if (e.getTarget() instanceof LivingEntity) {
e.setCancelled(true);
}
}
}
}
thats my code
That works at first, so hoglin wont attack me first as it normally does, but if i hit him once, he immediately starts attacking me
but other hostile mobs wont and work fine
So I assume its bugged for newer mobs?
these are the only warnings i have
the stacktrace you have will say what line the NPE occurred on
stacktrace being the spam that said null
wdym
the error you got in game (in the log)
its called a stacktrace.
you need to read that and find the first mention of YOUR code
it will tell you a line number and the class the error occurred in.
1 min
How can I make it so that when you run a command and put in args player names are not popping up in the list of possible args how can I change player names to a list of blocks
fixed it but ty
wasn't necessarily hard coded. The 8 bit colors that minecraft started with are the standard terminal colors.
implement TabCompleter
the standard used is the ANSI colors
ok
?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.
?ask
Im asking if anyone knows how to use NMS
anyway
i want to make a zombie with around 1k HP, some armor that is just for looks, give it speed 2, and make it drop a different item.
How
how do i check if a command was executed in a specific world?
doesnt 1.12 have the attribute api?
Check the players current world
When they execute the command
sender.getwrold or smthng
tyty
@kindred solar you would do sender.Location or smthng, then location.getworld
seems 1.12 does have attribute api already
so you dont even need nms
to change a entity max health
Player player = (Player)sender;
is all that is needed
then you can just player.getWorld();
for armor? LivingEntity has getEquipmet where you can set everything about the entity,main hand/offhand and armor
i did player.getworld.equals("world")
no
getWorld returns a World instance
getWorld().getName().equals
ah k tyy
read above
?
health using the attribute api,LivingEntity.getAttribute...generic max health...setbase value then set its health
armor? LivingEntity.getequipment then fire away
Oh, yea i figured that out
Yeah you don't need NMS
last resort
want a zombie to teleport like a enderman? thats nms
When you want to control aspects of the game that aren't in the API
When the api does not expose something that may only be accessible with nms
It is mostly used in legacy versions as the api wasnt as feature rich like it is nowadays
I used nms
ill i get more performance for doing that if statement, right?
to reimplement bees
to be a bit more interesting
built bee ai from the ground up
@kindred solar what exactly is the final goal
depends..
Hey there,
Is it possible to implement path finding for EntityPlayer in NMS?
just dont have bugs in my server by typing commands
I mean why
nope
people always think they can go the easy way to create a npc that way
entityplayer lacks alot of stuff needed for pathfinding
as it shouldnt be a thing
So basically there is no way of doing this? or I'm thinking wrong cuz I see some people using human npc for their plugin to follow a player
thats packets
basically you have to fully manage that said npc
constantly refreshing
what he does
he follows a player?you have to keep track of the current location,the new location it should be at,update the packet so it looks like it moved,while also updating the animation packet to simulate walking/running
alot of shit...
you can always "inspire" from citizens
I used fake Network Manager to create many human npcs and they work perfectly and they spawn and nothing is wrong with that and I used world.addEntity(playerentity) for adding the npc to the world so it can easily interact with the environment.
yes
but seems I cannot use goalFinder in EntityPlayer class
that will spawn a player being useless
cuz it doesn't exist
so the best way is to make an another entity which is not player like zombie, then shape it like a human and then disguise it as a human player and using path finders right?
you could using some libs
but you need to keep an eye on performance
just to be sure
I tried citizens, and it was working pretty good but initially I wanted to create my own pathfinding and do some stuff relating to ai
citizens navigation and pathfinding was not really complete and perfect
you are not the only one
most people get hit by the implementation after thinking of some good logic
e.q bandits/hostile npcs on adventure servers or shit
yea agree
popo
what's the difference between build and rebuild (when build artifacts)?
don't use IntelliJ artifacts, use a proper build system: Maven or Gradle
Build builds any changed files. rebuild builds all files, changed or not
lol sry
How can I verify that there are no blocks in a location?
Get the block, see if it's air
There is never "no block" at any location
There is at least air.
what's the color code for brown? does some1 know?
ChatColor.
ah k ty
you can;t delete air
delete the air
AIR is a block, it has no delete method
brown doesnt exists
if(q.getType() == Material.AIR) {
//Code...
}```Would that be okay?
Plugin orebfuscator load (but I remove this plugin with folder plugins)
Yes, but personally I prefer guard clauses.
i.e. if (!q.getType() == Material.AIR) return;
use gold or use teh bungee chatcolor for Hex colors
k ty
how do i do the 2nd option
delete your spigot import and choose the md_5 one when offered
Hi. Why my if doesnt work?
if(p.getInventory().getItemInMainHand().equals(Material.WHEAT)){
import net.md_5.bungee.api.ChatColor;
just do that in imports?
don't compare enums with .equals, and you have to get the type of getItemInMainHand()
to replace your bukkit import
that ill cause me a lot of troubles, wont it?
no
So what i need to change?
What the if should look like
getItemInMainHand().getType() == Material.WHEAT
let me know if i got it, just put it under all my imports right?
Error: java: incomparable types: org.bukkit.inventory.ItemStack and org.bukkit.Material
you didn't add the getType()
so long as you removed the bukkit chatcolor import
a ok
but i already have other chatcolor stuff
?paste
Does anyone know if entitytargetevent is bugged for newer mobs? Like zoglin & hoglin. Im canceling the targentevent for them, it works at first, but if i hit the hoglin he still starts to attack me. The code works perfectly for other mobs but not for zoglins & hoglins
@EventHandler
public void onWrongTarget(EntityTargetLivingEntityEvent e) {
if (main.getConfig().getBoolean("hostile-mobs-attack") == false) {
if (e.getEntity() instanceof Hoglin) {
if (e.getTarget() instanceof LivingEntity) {
e.setCancelled(true);
}
}
}
}
You are modifying something Async
Hello! I've been trying to set a max amount of allowed chests to be opened per player but I don't seem to get it right, I've tried a lot of things and it's gone horribly wrong...Anyone here know how I can do this?
me ?
yes
What do you mean, do you mean like they can only open 5 chests at all within a certain time? Where do you mean ever? Are you referring to special chest, or chest in general?
Allowed chests total and yes normal chests
You can create a map with key uuid and value integer, then every time they open the chest you would check if the stored integer is that the max amount, and if it is yell at them and cancel the event. If it is not, increment it.
Just be sure to jump the map to config at shut down, and populate on load. Also don't forget to clean the map when the player logs out.
Dump not jump, damn speech-to-text haha
Are you going to let them ever reset their counter? You'd want to code in some logic for that as well.
Yeah, it's a minigame ish thing so when the round ends, it resets I guess and when a new round starts, it starts to count again
Ah, that's good, that makes it easy to do then.
Also in your code, I would not hard-code your limits. I see people in the forums all the time hard coding stuff like that. You're much better off to pull that stuff from config, so if you decide later to change how it works you don't have to recompile your plug-in.
where you think
Just use an expiring cache hashmap and problem solved
and yes, make it a configurable option to change the amount of chests that can used.
I'm not familiar with that, is that a special type of collection with a built-in time?
You mean like just adding the allowed amount of chests in a config and just change the amount there later? yeah
You can make it expire at a specified time, which means you don't really have to worry about clearing the map yourself and then creating the entire thing again
its part guava which is shaded into spigot 🙂
so nothing new needs to be added
That's pretty cool. Nice.
you can even make the cache expire for other reasons
like if it gets written to, it expires it or expire on read etc
and then if it does expire
you can set it to refresh itself
IE, recheck configs to see if them chest counts should be increased
or if its expired instead of nulling out or throwing NPE's lets create the new object and put it back in the cache
many many things you can use it for and super handy a lot of the times
Okay, thank you to both of you for helping!
one of these days I will specifically do youtube videos of The more you know with plugin coding
and everyday it will just be something new it brings up that a lot of people are just not familiar with
public Entity spawnBossEntity(Location loc) {
Zombie bossEntity = loc.getWorld().spawn(loc, Zombie.class);
if (plugin.getConfig().contains("bosshealth")) {
long bossHealth = plugin.getConfig().getLong("bosshealth");
bossEntity.setMaxHealth(bossHealth);
bossEntity.setHealth(bossHealth);
}else {
plugin.getLogger().log(Level.SEVERE, "BossHealth is missing in config... Setting to 1000...");
plugin.getConfig().set("bosshealth", 1000);
bossEntity.setMaxHealth(1000);
bossEntity.setHealth(1000);
}
return bossEntity;
}
how do i apply NBT to this entity
1.12
I want to apply it, then check for it later
metadata was a thing before that
But thats sadly not persistent
only difference from then and now is that it didn't persist
So do i have to redo the entity stuff in NMS?
depends what you are comfortable with doing
You can get the NMS entity from the bukkit entity and tinker with its NBT tags.
There is also a library for NBT data.
Ok
If you don't want to use NMS, then its just a matter of you tracking that information between restarts and re-applying it yourself
EntityLiving nmsLiving = ((CraftLivingEntity) entity).getHandle();
guys i was with 2 players on the server but the scoreboard wasnt updating the online players
7smile i gtg ill work on this later. thanks for the help ill write that down
how can i update everyone's scoreboard when some1 joins?
PlayerJoinEvent -> Update scoreboard
...
You have to destroy and recreate the scoreboard if I remember correctly
to update custom stuff on scoreboards
but my friend joined and for him i think it was 2 players and for me was only 1
Are you sure? I didnt really play around with scoreboards that much but this seems a bit excessive. Let me write a little test.
If the item you are trying to update isn't something native to scoreboards to keep track of, yes
its a pain sometimes
So i am using a method to reset a map for a minigame by deleting the world file and making a copy from a source world file that is the unmodified map. It works fine the only issue is i get an error when i try to reset it and nobody as been on the source world to load it.
The process cannot access the file because another process has locked a portion of the file
how do i stop this from happening?
you need to unload all the chunks
or simply unload the world
before removing the world
when i have
if (player.getWorld() == World.Environment.THE_END) {
}
it gives me the error: Incompatible operand types World and World.Environment
How do i fix this? PS: I'm new to java
the error isn't when deleting the world it's when copying from the source world@wet breach
then your problem lies in the copying code
somewhere you are returning objects involved with it, and thus locking up the files
but it works fine if i go to the source world before resetting the map.
what do you mean if you go to the source world?
are you saying you have the source world loaded into the server ?
yes
that is your problem
do i need to unload it?
never load the source world, just keep it in a directory
ok
and then just copy files you need, load the new world and only the new world
then you won't have problems with file locking
also to avoid waiting on world deletion
create a method to create a new ID every time you make a new world
and have people join that new world, this way the server doesn't have to rush to delete old worlds 🙂
well it deletes in like 4 ticks so it's not much of an issue currently but ill keep that in mind
example. lets say your source world is named tagworld. Everytime you copy that source world to a new directory to load for the server, append it with a random ID
@unkempt peak currently not an issue
but when you have 4-5 games going at the same time, why waste cpu resources deleting worlds that can be done at the end of the day
only concern is HDD space lol
that's true
i might implement it later if i see any preformance issues
thanks for the help
and the deleting of the worlds doesn't need to be done from plugin
you can totally make a bash script to handle that
thus further not impeding the mc server 🙂
the more things that don't need to be done in the MC server itself the better 😉
and then to further help with the task, set the bash script as a cron job to run at whatever intervals you specify lol
when i have
if (player.getWorld() == World.Environment.THE_END) {
}
it gives me the error: Incompatible operand types World and World.Environment
How do i fix this? PS: I'm new to java
if(player.getWorld().getEnvironment() == World.Environment.THE_END) { }
yeah currently the way im doing is i have minigame-mapname as the source world and then to run multiple games it just automatically creates 3 copies and then to reset a minigame it deletes minigame-mapname-1 and copies minigame-mapname to minigame-mapname-1
?jd
package index
can you do player.getWorld().getEnvironment() ?
the way I did it for a fairly large MC network, was to create a 6 digit ID for the new maps, which was usually just the time in 24 format plus the day. Had a bash script that ran every 6-8 hours that would check these digits against the current day and time. If it was old it deleted it. Bash script was configured based on how many games were allowed to be running at one time and thus would leave that many worlds.
@opal juniper #help-development message
oh, bit late lmao
Ok that makes sense i will need to learn some bash to do it but ill take a look at it
thanks
super easy and super easy creating the cron job too
and good news, there is plenty of tutorials to do both
yeah should be pretty easy to learn
guys which of these is more efficient method for updating player data on database?
a) update data per-variable every time something changes
b) make a timer that loops through loaded players every few seconds and updates entire player records at a time (those that have changed at least 1 thing)
keep in mind all db activity is async ofc, also i may be using more than 1 layer of database (ideally redis + mysql but just mysql for now)
Depends how often things change
that makes sense
The one that happens the least will probably be the fastest
I know luckperms use a daemon task to update everything every 30 seconds or so
yeah this isnt data thats gonna be updated often, maybe not even every session except for the last-seen so im gonna guess individual variables
ty
😄
@cloud berry could use expiring cache for this. When cache expires you can have it update the DB before it completely removes object from cache.
ehh that would rely on the server not crashing in between... not exactly a given xDDDD
not sure how that would be different with your loop
if the server crashes nothing is going to save lol
LEOcab I know guava has some cool loading caches but maybe try caffeine (altho needs shade and prob relocate also)
well true i guess its the same thing xD
with the cache you can just have it expire if the object hasn't been touched
^
this way you are not keeping things in memory that really just haven't been used
if it is needed it can easily load it if its not in the cache
I'll link you this https://github.com/ben-manes/caffeine in case you're interested
It also has async caches but normally you wanna handle that yourself
oh actually i did plan on having a cache, i just havent gotten to that part yet ;-;
Guava, Apache, Caffeine and few other libs have expiring caches 🙂
use the one you are best comfortable with really
Just use Guava, already bundled in 🙂
yes
yeah I just like caffeine as it removes the throws declaration as opposed to guava iirc and uses interfaces instead of abstract classes
ill be using these instead of runnable for the cache xD ty guys 😄
technically a runnable is used, but these are more efficient, cleaner and easier to use for such things.
it kind of abstracts away the work you would otherwise have to implement yourself in a good way
this might get complicated cause its a two-way cache :I
server <-> database <-> server
what is the database btw?
ohhhh ok yeah saves me time & brainpower LOL
combine this with redis
server specific shit like ranks (not perm ranks), join date, vote counts, time played, session tables etc
if you don't want to worry about the logic of saving to a DB
this way you can make your cache only worry about redis, and redis handles the fetching/saving to DB 😄
omg yes 😄 was plannin on it lol
leocab hmm so you use redis but what type of persistent database?
going to assume the standard SQL DB stuff
hmm okay
not only speed, but to handle some logic of the loading/unloading you won't need to program 😉
i literally aint even got started wit redis yet ;-; jooq way easier than i thought it would b doe
idek which ones there r ;-; i just picked it cause several ppl recommended it lol, i just did some basic research on it so i just kno the basics of how it works
do u know a good 1?
or "api" more like it better helps you deal with multithreading stuff
you mean jredis @ivory sleet ?
Is it possible to host a functional discord bot on a Minecraft Plugin?
yes
oh yeah
that might be the name
~~https://github.com/redis/jedis ~~hmm this one anyways
ah
the workflow visualized
or modality
looks good
Hey! I have this code right here, works totally fine and all but I can't seem to get the x amount of chests.
public static ArrayList<Player> ChestOpen = new ArrayList<>();
public static HashMap<Player, Integer> ChestsOpen = new HashMap<>();
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getClickedBlock().getState() instanceof Chest) {
if (!GlobalState.isState(GlobalState.WARMUP) || GlobalState.isState(GlobalState.IN_GAME)) {
e.setCancelled(true);
} else {
if (ChestAllowedUpdater.canOpenChest == true) {
e.setCancelled(true);
e.getClickedBlock().setType(Material.AIR);
if (!ChestsOpen.get(p).equals(thing.getInstance().getConfig().getInt("chests-per-player") - 1)) {
int toAdd = 1;
int newChestsOpened = toAdd + ChestsOpen.get(p);
ChestsOpen.put(p, newChestsOpened);
}
} else {
e.setCancelled(true);
ChestsOpen.remove(p);
ChestOpen.remove(p);
p.sendMessage(ChatColor.translateAlternateColorCodes('&', MessagePrefix.messagePrefix() + "&7You have already opened " + thing.getInstance().getConfig().getInt("chests-per-player") + " chests!"));
}
}
}
}
public static int totalChests(Player player) {
return ChestsOpen.size();
}```
create a class for your hashmap
or just simply do ChestsOpen.get(player.getUUID());
never put the player object into the hashmap
use the player's UUID as the key
also, don't use static everywhere either
public ConcurrentHashMap<UUID, Integer> ChestsOpen = new ConcurrentHashMap<>();
Also recommend using concurrenthashmap here in case you need to do update/read at the same time. Prevents some other types of problems 😉
Hey, I have this code to place a block in the direction of the player, but I can't get it to be placed right in front, that is, if the player is looking down, it is placed right where he is and pushes him and I don't want that p = (Player) sender; Location Lp = p.getLocation(); Vector vec = p.getLocation().getDirection(); vec.setY(0); Location frontlocation = Lp.add(vec); Block q = frontlocation.getBlock(); if(q.getType() == Material.AIR) frontlocation.getBlock().setType(Material.DIAMOND_BLOCK);
if they are looking down, teleport them 1 block up at the same time of placing a block where they were at
easy to check if where they are placing a block, is the same spot the player is standing
🤯
Can I set a book title as a string variable?
elaborate ?
so I have this command that is supposed to give a spicific player a book titled one of the arguments in the command
2 questions:
1: how much values can an ArrayList have without creating lag/errors?
2: What Encoding does the Server-Console have? (If it works that way lol)
Yeah ofc, its hard to say exactly as it depends what type of objects
So I did bookmeta.setTitle(<StringVariableHere>); Is that an option
because when i get the book
How many do you plan to fit?
it just calls it Written book
do u set the meta?
while ((s = bufferedreader.readLine()) != null) {
if (!logLines.contains(s)) {
logLines.add(s);
//do some other stuff
}
}
i am basically getting the lines from the console-log-file, and adding them into the arrayList, to make sure they doesn't get readed multiple times
well i do
so question now is, how many lines/Strings can that list contain
before i have to clear it
I think I am getting the meta and setting it? is that not right?
I am trying to make a Hypixel looking AFK system here and does anyone know how I can repeat sending this title and subtitle whilst the player is AFK in Limbo? Current code: ```java
public class autoafk implements Listener {
@EventHandler
public void onKick(ServerKickEvent e){
if(e.getKickReason().contains("afk")){ //spigot plugin kicks players for 'afk' when they are afk
if ((e.getPlayer() instanceof ProxiedPlayer)) {
ProxiedPlayer p = e.getPlayer();
e.setCancelled(true);
p.connect(ProxyServer.getInstance().getServerInfo("limbo"));
if(p.getServer().equals("limbo")) {
ProxyServer.getInstance().createTitle()
.title(new ComponentBuilder("You are AFK")
.color(ChatColor.RED).create())
.subTitle(new ComponentBuilder("Move around to return to the lobby.")
.color(ChatColor.YELLOW).create())
.fadeIn(20)
.stay(-1)
.fadeOut(20)
.send(p);
}
currently (localhost, just for testing) 1gb, on my main server it's.... let me see
might be wise to specifically set the buffer
buffer size I mean*
3.5GB
a good limit is 1024 for text files
if you are making the buffer 3.5GB then really defeating the purpose of the buffer
How do I initialize this hashmap for players for example?
public final static Map<Player, Skill> skillMap = new HashMap<Player, Skill>();
its already instantiated if thats ur question
but you'd use skillMap.put(playerInstance,value)
assume you wanna initialize a value for a specific player
what is with everyone using statics suddenly again
How do I assign players for example?
just dont want to work with that directly-get-from-console stuff, that is so confusing to me, so i am doing it this way
time travels backwards x)
loggers*
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
if (label.equalsIgnoreCase("arm")) {
ArmorStand as = (ArmorStand) p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
as.getName().equalsIgnoreCase("arm");
}
return false;
}
}``` Hello, right here I've made a command to spawn an AS at player, But I want the AS to spawn with diamond armor, How do I do that?
@sullen dome the way I am suggesting doesn't use loggers, but you don't need the buffer to be 3.5GB. If you really want to do it that way then just use memorymapped files.
well, i can use a logger, to log the file directly from the console, instead of from the latest.log. but it's complicated, so i did it like this.
for me it is complicated
declaration: package: org.bukkit.inventory, interface: EntityEquipment
Thanks.
[18:11:16 ERROR]: Error occurred while enabling TestPlugin v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at com.mounterisastudios.testplugin.commands.HelloCommand.<init>(HelloCommand.java:26) ~[?:?]
at com.mounterisastudios.testplugin.Main.onEnable(Main.java:10) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:494) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:408) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:435) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:218) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:809) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_271]
Any help?
what is line 26 in HelloCommand
your HelloCommand is null
plugin.getCommand("startgame").setExecutor(this);
wait... shouldn't that be in the onEnable?
startgame command is not correctly entered in your plugin,.yml
could be, yeah
oof lol right
it is
im new to java
which console?
its not, its system based
(The latest.log to be clear)
yeah almost every new java programmer falls into that trap
feels like
@sullen dome it uses whatever is set for the JVM. If this isn't specifically set for the JVM it uses whatever the system default is.
normally on linux it uses system default, on windows java puts a default for the JVM in the settings
you can override this with a JVM argument as well btw
it didn't create them
convert*, whatever
what happens is the encoding the JVM uses couldn't properly handle whatever those icons were before and so that is how it is saved. UTF-8 isn't going to magically reverse broken characters from an encoding that couldn't handle it to begin with.
it is. default console isn;t
well nvm, i see the icons are in the logfile as well lol
thought they are broken on the way from logfile to discord-channel
Yep, when the character being saved, falls outside of the encoding can handle, it just turns them into squares instead of just missing characters
to indicate there was something here, but couldn't be saved properly
most of the time it is just color codes
could it be this? >
no, its the encoding for colors
why are there colorcodes used
you can't see it in console because the console is interpretting the codes properly, it just can't save them properly.
yeah git bash is just ignoring them
https://paste.md-5.net/heheyifulu.java should this work? When i do the command /addplayers it executes the command /startgame
https://paste.md-5.net/heheyifulu.java#L27 because you told it that the executor for a command named addplayers is that class
so what needs to happen in your code logic below that
is you need to look at the command that was executed
and execute the appropriate block code depending which command it was
well, do i have to ignore that fucked-up squares, or can i remove them somehow before sending them?
you can remove them, generally they get defaulted to a square character like that, so what you can do is check the squares code point for the character and see if they are all the same. Generally should be. And then just filter out those characters 🙂
or you can just simply do nothing
those characters are not going to do any harm
they are harming my one working eye lol
lol
would use .replace(), but cant copy that square into code lol
you can copy that square into code @sullen dome
holy god
ups
when using as string it looks like this
do all those Objects.requireNonNull() actually helps? hate intellij for showing it as error without them
good to know
but it becomes more apparent I guess
as i always ignore that yellow lines lol
should i take them out?
yeah same
doesnt matter i guess
@sullen dome the character is just ^
why would that be there
but here I have a regex that will catch them since they are different depending on the color being used
because that is the control character for ANSI colors
which is what minecraft uses for color codes
well the console does anyways
's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g'
that is the regex to catch the ANSI control characters up to 256
fortunately you don't need to go beyond that
holy god, that looks like you got that from a like 9 years long coding class lol
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as command...
well good news, you don't have to figure out the regex 😄
I just gave it to you lol
so you do a replace using the regex as the pattern to match
and replace it with nothing
either one works, the first will add a space in the place of the character the second will just remove the character
ok then i use the sec
are the ' actually with the regex? or was that just a wrong wrote
not part of the regex
but you need to use ' ' though
well I guess you could use " "
`` doesnt work