I need one help with my plugin

Discussion in 'Plugin Development' started by nickgs1337, Mar 27, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    nickgs1337

    My plugin works perfectly on my computer
    But when going to any other computing it does not "work"
    I already checked everything.
    detail: the plugin on other computers just not read, does not recognize any command, basically bukkit ignore my plugin
    Anyone have any idea of what can be?
     
  2. Offline

    L33m4n123

    Show us your code. Show us the error if there is any. And last but not least. Wrong section ;)
     
  3. Offline

    ZeusAllMighty11

    If I were to take a wild guess, it would be that your java version in your plugin is incompatible with the version running on the computer.
     
    Garris0n likes this.
  4. Offline

    nickgs1337


    ok this is my code, sorry some things are in Portuguese,
    is that I am Brazilian :/

    Code:java
    1. package br.com.redeyes.nickgs.bolao;
    2.  
    3. import java.io.File;
    4. import java.io.IOException;
    5. import java.util.ArrayList;
    6. import java.util.Arrays;
    7. import java.util.List;
    8. import java.util.Random;
    9.  
    10. import org.bukkit.ChatColor;
    11. import org.bukkit.command.Command;
    12. import org.bukkit.command.CommandSender;
    13. import org.bukkit.configuration.file.FileConfiguration;
    14. import org.bukkit.entity.Player;
    15. import org.bukkit.plugin.java.JavaPlugin;
    16. import org.bukkit.scheduler.BukkitRunnable;
    17.  
    18. import com.iCo6.system.Accounts;
    19. import com.iCo6.system.Holdings;
    20.  
    21. public class main extends JavaPlugin {
    22. ArrayList<String> leks = new ArrayList<>();
    23. public final Accounts ac = new Accounts();
    24. int arrecadado;
    25. Random r = new Random();
    26. boolean iniciado = false;
    27. boolean gerando = false;
    28. int segundo = 0;
    29. private List<String> message = new ArrayList<String>();
    30.  
    31. String fimsemvencedor, fulanoganhou, parabensvoceganhou,
    32. oganhadorsaiudoservidor, anunciobolao, usocorreto, vocejaapostou,
    33. voceapostou, vocenaotemdinheiro, bolaonaoestaemandamento,
    34. voceiniciou, obolaojaestaemandamento, vocenaotemperm;
    35. int tempototal, tempodeanuncio, dinheiro;
    36. @Override
    37. public void onEnable() {
    38. if(!new File(getDataFolder(), "NICKGS_RESET.FILE").exists()){
    39. try {
    40. new File(getDataFolder(), "NICKGS_RESET.FILE").createNewFile();
    41. } catch (IOException e) {
    42. e.printStackTrace();
    43. }
    44. config().set("fimsemvencedor", "&d[Evento] &cFim de evento, nao houve um vencedor!");
    45. config().set("fulanoganhou", "&d[Evento] &6%ganhador% &aganhou&6 $%quantidade% &aCoins no bolao!");
    46. config().set("parabensvoceganhou", "&d[Evento] &aParabens voce ganhou o bolao");
    47. config().set("oganhadorsaiudoservidor", "&d[Evento] &6O ganhador do bolao saiu do servidor .-.!");
    48. config().set("anunciobolao", Arrays.asList("&d[Evento] Evento Bolao!!","&d[Evento] Para participar digite: /bolao apostar", "&d[Evento] Premio acumulado: %quantia%"));
    49. config().set("usocorreto", "&f[&bBolao&f] Uso correto: /bolao apostar");
    50. config().set("vocejaapostou", "&f[&bBolao&f] &cVoce ja apostou!");
    51. config().set("voceapostou", "&f[&bBolao&f] &aVoce apostou!\n&aValor: &6%quantidade%&a!");
    52. config().set("vocenaotemdinheiro", "&f[&bBolao&f] &cVoce nao tem dinheiro suficiente");
    53. config().set("bolaonaoestaemandamento", "&f[&bBolao&f] &cO bolao nao esta em andamento!");
    54. config().set("voceiniciou", "&f[&bBolao&f] Voce iniciou o bolao");
    55. config().set("obolaojaestaemandamento", "&f[&bBolao&f] &cO bolao ja esta em andamento!");
    56. config().set("vocenaotemperm", "&f[&bBolao&f] &cVoce nao pode fazer isto!");
    57. config().set("config.tempototal", 300);
    58. config().set("config.tempodeanuncio", 15);
    59. config().set("config.dinheiro", 500);
    60. saveConfig();
    61. }
    62. for(String msg : getConfig().getStringList("anunciobolao")){
    63. message.add(msg);
    64. }
    65. fimsemvencedor = config().getString("fimsemvencedor");
    66. fulanoganhou = config().getString("fulanoganhou");
    67. parabensvoceganhou = config().getString("parabensvoceganhou");
    68. oganhadorsaiudoservidor = config().getString("oganhadorsaiudoservidor");
    69. anunciobolao = config().getString("anunciobolao");
    70. usocorreto = config().getString("usocorreto");
    71. vocejaapostou = config().getString("vocejaapostou");
    72. voceapostou = config().getString("voceapostou");
    73. vocenaotemdinheiro = config().getString("vocenaotemdinheiro");
    74. bolaonaoestaemandamento = config().getString("bolaonaoestaemandamento");
    75. voceiniciou = config().getString("voceiniciou");
    76. obolaojaestaemandamento = config().getString("obolaojaestaemandamento");
    77. vocenaotemperm = config().getString("vocenaotemperm");
    78.  
    79. tempototal = config().getInt("config.tempototal");
    80. tempodeanuncio = config().getInt("config.tempodeanuncio");
    81. dinheiro = config().getInt("config.dinheiro");
    82.  
    83.  
    84. new BukkitRunnable() {
    85. @Override
    86. public void run() {
    87. if (iniciado && segundo == tempototal) {
    88. if (leks.isEmpty()) {
    89. getServer()
    90. .broadcastMessage(
    91. conversor(fimsemvencedor));
    92. segundo = 0;
    93. iniciado = false;
    94. leks.clear();
    95. arrecadado = 0;
    96. } else {
    97. Player ganhador = getServer().getPlayerExact(seletor());
    98. if (ganhador != null) {
    99. getServer().broadcastMessage(
    100. conversor(fulanoganhou.replaceAll("%ganhador%", ganhador.getName())).replaceAll("%quantidade%", ""+arrecadado));
    101. ganhador.sendMessage(conversor(parabensvoceganhou));
    102. ac.get(ganhador.getName()).getHoldings()
    103. .add(arrecadado);
    104. ganhador.chat("/money");
    105. segundo = 0;
    106. iniciado = false;
    107. leks.clear();
    108. arrecadado = 0;
    109. } else {
    110. getServer()
    111. .broadcastMessage(
    112. conversor(oganhadorsaiudoservidor));
    113. segundo = 0;
    114. iniciado = false;
    115. leks.clear();
    116. arrecadado = 0;
    117. }
    118.  
    119. }
    120. } else if (iniciado && segundo % tempodeanuncio == 0) {
    121. segundo++;
    122. for(String msg : message){
    123. getServer().broadcastMessage(conversor(msg.replaceAll("%quantia%", ""+arrecadado)));
    124. }
    125. } else if (iniciado) {
    126. segundo++;
    127. }
    128. }
    129. }.runTaskTimer(this, 0l, 20l);
    130.  
    131. }
    132.  
    133. @Override
    134. public void onDisable() {
    135. }
    136.  
    137. @Override
    138. public boolean onCommand(CommandSender sender, Command command, String CL,
    139. String[] args) {
    140. Player p = (Player) sender;
    141. Holdings hp = ac.get(p.getName()).getHoldings();
    142. if (CL.equalsIgnoreCase("bolao")) {
    143. if (args.length == 0) {
    144. p.sendMessage(conversor(usocorreto));
    145. } else {
    146. if (args[0].equalsIgnoreCase("apostar")) {
    147. if(!p.hasPermission("bolao.apostar")){
    148. p.sendMessage(conversor(vocenaotemperm));
    149. }else{
    150. if (iniciado) {
    151. if (hp.hasEnough(dinheiro)) {
    152. if (leks.contains(p.getName())) {
    153. p.sendMessage(conversor(vocejaapostou));
    154. } else {
    155. p.sendMessage(conversor(voceapostou.replaceAll("%quantidade%", ""+dinheiro)));
    156. hp.subtract(dinheiro);
    157. arrecadado += dinheiro;
    158. leks.add(p.getName());
    159. }
    160. } else {
    161. p.sendMessage(conversor(vocenaotemdinheiro));
    162. }
    163. } else {
    164. p.sendMessage(conversor(bolaonaoestaemandamento));
    165. }
    166. }
    167. } else if (args[0].equalsIgnoreCase("iniciar")) {
    168. if (p.hasPermission("nickgs.iniciar.bolao")) {
    169. if (!iniciado) {
    170. sender.sendMessage(conversor(voceiniciou));
    171. iniciado = true;
    172. for(String msg : message){
    173. getServer().broadcastMessage(conversor(msg.replaceAll("%quantia%", ""+arrecadado)));
    174. }
    175. } else {
    176. sender.sendMessage(conversor(obolaojaestaemandamento));
    177. }
    178. } else {
    179. p.sendMessage(conversor(vocenaotemperm));
    180. }
    181.  
    182. }
    183. }
    184. }
    185. return false;
    186. }
    187.  
    188. public String conversor(String msg) {
    189. return ChatColor.translateAlternateColorCodes('&', msg);
    190. }
    191.  
    192. public String seletor() {
    193. gerando = true;
    194. String leke = "";
    195. int x = r.nextInt(leks.size());
    196. String aa = leks.toString();
    197. aa = aa.replace("[", "");
    198. aa = aa.replace("]", "");
    199. aa = aa.replaceAll(" ", "");
    200. String[] lek = aa.split(",");
    201. if (x == 0) {
    202. if (getServer().getPlayer(lek[x]) != null) {
    203. leke = lek[x];
    204. gerando = false;
    205. }
    206. } else {
    207. if (getServer().getPlayer(lek[x - 1]) != null) {
    208. leke = lek[x - 1];
    209. gerando = false;
    210. }
    211. }
    212. return leke;
    213.  
    214. }
    215. public FileConfiguration config(){
    216. return getConfig();
    217. }
    218. }
    219.  
     
  5. Offline

    TnT

    Moved to the correct forum.
     
  6. Offline

    nickgs1337

    all computers are windowns, why you moved for linux?
     
  7. Offline

    MrInspector

    I'm not sure what you mean by that..

    But, maybe your plugin is compiled in a different java version than the other servers. ;)
     
Thread Status:
Not open for further replies.

Share This Page