1

Coding Help

DHATBOISAM's Avatar DHATBOISAM5/14/14 3:36 pm
5/14/2014 7:12 pm
some1epic123's Avatar some1epic123
I want it to detect player kills.
Every kill they get 10 Trophies.
or run a command.
Posted by DHATBOISAM's Avatar
DHATBOISAM
Level 43 : Master Architect
55

Create an account or sign in to comment.

25

DHATBOISAM
05/14/2014 7:11 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
and i did that cause i don't know how to make a point system, so i use another plugin to add points
1
some1epic123
05/14/2014 7:12 pm
Level 23 : Expert Modder
some1epic123's Avatar
Ah, that makes more sense. PM me if you have any further issues, and please work more on learning Java.
1
DHATBOISAM
05/14/2014 7:10 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
I am not good i'm a nood
1
DHATBOISAM
05/14/2014 6:26 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
its not working
1
some1epic123
05/14/2014 6:33 pm
Level 23 : Expert Modder
some1epic123's Avatar
Wrong sender, and you should not put / in the command string.
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)
{
...
...
}

}
1
some1epic123
05/14/2014 6:16 pm
Level 23 : Expert Modder
some1epic123's Avatar
What is the problem you're having with that code?
1
DHATBOISAM
05/14/2014 6:15 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
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
1
DHATBOISAM
05/14/2014 5:55 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
but I need a plugin for my server
1
some1epic123
05/14/2014 6:09 pm
Level 23 : Expert Modder
some1epic123's Avatar
This plugin is pretty simple, so you can ask someone else to make it while you learn Java before returning to making your own.
1
bmanrules
05/14/2014 6:02 pm
Level 57 : Grandmaster Programmer
bmanrules's Avatar
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.
1
DHATBOISAM
05/14/2014 5:19 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
mind you i dnt know how to put anything together i'm trying my best to learn java
1
bmanrules
05/14/2014 5:48 pm
Level 57 : Grandmaster Programmer
bmanrules's Avatar
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
1
DHATBOISAM
05/14/2014 5:16 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
can you write me a tut
1
DHATBOISAM
05/14/2014 4:20 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
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
1
some1epic123
05/14/2014 5:02 pm
Level 23 : Expert Modder
some1epic123's Avatar
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).
1
DHATBOISAM
05/14/2014 4:13 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
I dont know how to make it run a command or how to add a trophy thing
1
some1epic123
05/14/2014 4:15 pm
Level 23 : Expert Modder
some1epic123's Avatar
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?
1
DHATBOISAM
05/14/2014 4:12 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
@EventHandler
public void onKill(PlayerDeathEvent e)
{
String killed = e.getEntity().getName();
String killer = e.getEntity().getKiller().getName();
1
DHATBOISAM
05/14/2014 4:07 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
lol im a noob!

But ill show code
1
some1epic123
05/14/2014 4:04 pm
Level 23 : Expert Modder
some1epic123's Avatar
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.
1
DHATBOISAM
05/14/2014 4:02 pm
Level 43 : Master Architect
DHATBOISAM's Avatar
Can anyone help?
1
Jacob Rigoberto
05/14/2014 3:48 pm
Level 43 : Master Pokemon
Jacob Rigoberto's Avatar
Sigh..
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();
1
nickfromgreece
05/14/2014 3:58 pm
Level 54 : Grandmaster Programmer
nickfromgreece's Avatar
Uhh what is this even for o.O
1
41paladinman
05/14/2014 4:16 pm
Level 24 : Expert Dragonborn
41paladinman's Avatar
It creates a bubble version of your name, that jumps around when you mouse over it. I think this was a joke.
1
Navbarry
05/14/2014 3:39 pm
Level 42 : Master Blob
Navbarry's Avatar
This is not asking for coding help. This is asking for somebody to create the code. So it should be request.
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome