1
Coding Help
I want it to detect player kills.
Every kill they get 10 Trophies.
or run a command.
Every kill they get 10 Trophies.
or run a command.
Create an account or sign in to comment.
25
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
and i did that cause i don't know how to make a point system, so i use another plugin to add points
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
Ah, that makes more sense. PM me if you have any further issues, and please work more on learning Java.
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
I am not good i'm a nood
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
its not working
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
Wrong sender, and you should not put / in the command string.
Use this:
EDIT: Why are you using a command instead of calling your method to give the points?
Use this:
public onKill(PlayerDeathEvent e, Player player)
{
String killed = e.getEntity().getName();
String killer = e.getEntity().getKiller().getName();
int pointsGiven = 10;
Bukkit.dispatchCommand(player, "points give " + killer + " " + pointsGiven);
}
EDIT: Why are you using a command instead of calling your method to give the points?
Points.addPoints(killer, Points.DEFAULT_POINTS);
public class Points{
public static int DEFAULT_POINTS = (10); //The default amount of points given
/**
* Gives points to the player
*
* @param player - The player that is receiving the points
* @param points - The amount of points to add
*
**/
public static void addPoints(Player player, int points)
{
...
...
}
}
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
What is the problem you're having with that code?
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
package Event;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class onKill extends JavaPlugin {
@Override
public void onEnable() {
}
public onKill(PlayerDeathEvent e)
{
String killed = e.getEntity().getName();
String killer = e.getEntity().getKiller().getName();
int pointsGiven = 10;
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "/points give " + killer + " " + pointsGiven);
}
@Override
public void onDisable() {
// TODO Insert logic to be performed when the plugin is disabled
}
}
can someone fix this
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class onKill extends JavaPlugin {
@Override
public void onEnable() {
}
public onKill(PlayerDeathEvent e)
{
String killed = e.getEntity().getName();
String killer = e.getEntity().getKiller().getName();
int pointsGiven = 10;
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "/points give " + killer + " " + pointsGiven);
}
@Override
public void onDisable() {
// TODO Insert logic to be performed when the plugin is disabled
}
}
can someone fix this
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
but I need a plugin for my server
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
This plugin is pretty simple, so you can ask someone else to make it while you learn Java before returning to making your own.
![bmanrules's Avatar](https://static.planetminecraft.com/files/avatar/146447_1.png)
Ok, so what's to stop you from learning the basics of Java and then making the plugin? you asked for coding help but you seem to just want to be handed the code instead.
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
mind you i dnt know how to put anything together i'm trying my best to learn java
![bmanrules's Avatar](https://static.planetminecraft.com/files/avatar/146447_1.png)
If you don't know how to put anything together, start with something smaller like a simple Java program with some methods (Great tutorials exist on a thing called Google )
When you've grasped the basics of the language then you should switch to plugins
When you've grasped the basics of the language then you should switch to plugins
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
can you write me a tut
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
lol let me be more specific @some1epic123
I am making a clash of clash of clans server
I need some way of getting trophies so i decided you need to kill and every kill you get 10 trophies every death you lose half which is 5
the trophy i think should be in a .txt like -- dhatboisam: 1600
ad should show somehow ingame
I am making a clash of clash of clans server
I need some way of getting trophies so i decided you need to kill and every kill you get 10 trophies every death you lose half which is 5
the trophy i think should be in a .txt like -- dhatboisam: 1600
ad should show somehow ingame
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
For running a command:
Bukkit.getServer().dispatchCommand(<sender>, <command string>);
For saving trophies:
All you'll need is some basic file reading/writing.
If you're not sure how do to that, I can write a tutorial for you.
(Already wrote most of a tutorial with sections for everything your plugin needs to do).
Bukkit.getServer().dispatchCommand(<sender>, <command string>);
For saving trophies:
All you'll need is some basic file reading/writing.
If you're not sure how do to that, I can write a tutorial for you.
(Already wrote most of a tutorial with sections for everything your plugin needs to do).
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
I dont know how to make it run a command or how to add a trophy thing
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
Ah, now you're being more specific. Could you describe exactly what the trophy is?
Is it an item, score saved in a file, or?
Is it an item, score saved in a file, or?
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
@EventHandler
public void onKill(PlayerDeathEvent e)
{
String killed = e.getEntity().getName();
String killer = e.getEntity().getKiller().getName();
public void onKill(PlayerDeathEvent e)
{
String killed = e.getEntity().getName();
String killer = e.getEntity().getKiller().getName();
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
lol im a noob!
But ill show code
But ill show code
![some1epic123's Avatar](https://static.planetminecraft.com/files/avatar/385732_8.gif)
Show us the code you already have. This seems really simple to do/figure out, so I don't see
why you'd need help with it if you know anything about Java.
why you'd need help with it if you know anything about Java.
![DHATBOISAM's Avatar](https://static.planetminecraft.com/files/avatar/1255720_5.png)
Can anyone help?
![Jacob Rigoberto's Avatar](https://static.planetminecraft.com/files/avatar/811895_1.jpg)
Sigh..
Fine
Fine
Click to reveal
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="http://s3.amazonaws.com/codecademy-content/courses/hour-of-code/js/alphabet.js"></script>
</head>
<body>
<canvas id="myCanvas"></canvas>
<script type="text/javascript" src="http://s3.amazonaws.com/codecademy-content/courses/hour-of-code/js/bubbles.js"></script>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
var red = [0, 100, 63];
var orange = [40, 100, 60];
var green = [75, 100, 40];
var blue = [196, 77, 55];
var purple = [280, 50, 60];
var myName = "Jacob Kolstad";
letterColors = [red, orange, green, blue, purple];
if(10 > 3) {
bubbleShape = "circle";
}
else {
bubbleShape = "square";
}
drawName(myName, letterColors);
bounceBubbles();
![nickfromgreece's Avatar](https://static.planetminecraft.com/files/avatar/179899_4.jpg)
Uhh what is this even for o.O
![41paladinman's Avatar](https://static.planetminecraft.com/files/avatar/1374031_13.png)
It creates a bubble version of your name, that jumps around when you mouse over it. I think this was a joke.
![Navbarry's Avatar](https://static.planetminecraft.com/files/avatar/189485_0.jpg)
This is not asking for coding help. This is asking for somebody to create the code. So it should be request.