Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Problem] Poprawa kodu


Rekomendowane odpowiedzi

Opublikowano

Z tego co wiem, to zwykle interfejsu nie deklaruje się jako abstrakcyjny. Metody również nie deklarujemy jako abstrakcyjne w interfejsie (więcej na ten temat: http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.1.1.1, i tutaj: http://stackoverflow.com/questions/641536/why-would-one-declare-a-java-interface-method-as-abstract). Tak naprawdę stworzenie abstrakcyjnego interfejsu nie jest potrzebne, ponieważ i tak będziemy implementować metody w innej klasie.

package de.tobiyas.racesandclasses.playermanagement.display;

public interface Display
{
  public void display(double paramDouble1, double paramDouble2);
  
  public void unregister();
} 
Opublikowano

 

Z tego co wiem, to zwykle interfejsu nie deklaruje się jako abstrakcyjny. Metody również nie deklarujemy jako abstrakcyjne w interfejsie (więcej na ten temat: http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.1.1.1, i tutaj: http://stackoverflow.com/questions/641536/why-would-one-declare-a-java-interface-method-as-abstract). Tak naprawdę stworzenie abstrakcyjnego interfejsu nie jest potrzebne, ponieważ i tak będziemy implementować metody w innej klasie.

package de.tobiyas.racesandclasses.playermanagement.display;

public interface Display
{
  public void display(double paramDouble1, double paramDouble2);
  
  public void unregister();
} 

Ja w javie jestem zielony ale chce usunac spolszczyc pewne slowa z pluginie ktore znajduja sie w tym pliczku , jakbys mogl to popraw mi go po dekompilacji ;d plossseee :D

Opublikowano

Nie rozumiem pytania. W takim sensie?

package de.tobiyas.racesandclasses.playermanagement.display;

public interface Pokaz
{
  public void pokaz(double arg1, double arg2);
  
  public void wyrejestruj();
} 
Opublikowano

Po podminieniu tego mam 1 error tu lunk do screena ; http://screenshooter.net/100105088/pdpvahb

 

package de.tobiyas.racesandclasses.playermanagement.display;

public interface Display
{
  public void display(double paramDouble1, double paramDouble2);
 
  public void unregister();
}

  public static enum DisplayInfos
  {
    MANA("MANA", ChatColor.WHITE, ChatColor.DARK_AQUA, ChatColor.BLUE),
    HEALTH("ZYCIE", ChatColor.RED, ChatColor.YELLOW, ChatColor.GREEN);
/*     */
/*     */     private final String name;
/*     */     private final ChatColor lowValueColor;
/*     */     private final ChatColor midValueColor;
/*     */     private final ChatColor highValueColor;
/*     */     private final boolean useName;
/*     */     private final boolean onlyUseOneValue;
/*     */
/*     */     private DisplayInfos(String name, ChatColor lowValueColor, ChatColor midValueColor, ChatColor highValueColor) {
/*  82 */       this(name, lowValueColor, midValueColor, highValueColor, false, false);
/*     */     }
/*     */
/*     */     private DisplayInfos(String name, ChatColor lowValueColor, ChatColor midValueColor, ChatColor highValueColor, boolean useName, boolean onlyUseOneValue)
/*     */     {
/*  87 */       this.name = name;
/*  88 */       this.lowValueColor = lowValueColor;
/*  89 */       this.midValueColor = midValueColor;
/*  90 */       this.highValueColor = highValueColor;
/*  91 */       this.useName = useName;
/*  92 */       this.onlyUseOneValue = onlyUseOneValue;
/*     */     }
/*     */
/*     */     public String getName() {
/*  96 */       return this.name;
/*     */     }
/*     */
/*     */     public ChatColor getLowValueColor()
    {
/* 100 */       return this.lowValueColor;
/*     */     }
/*     */
/*     */     public ChatColor getMidValueColor() {
/* 104 */       return this.midValueColor;
/*     */     }
/*     */
/*     */     public ChatColor getHighValueColor() {
/* 108 */       return this.highValueColor;
/*     */     }
/*     */
/*     */     public boolean useName() {
/* 112 */       return this.useName;
/*     */     }
/*     */
/*     */     public boolean onlyUseOneValue() {
/* 116 */       return this.onlyUseOneValue;
/*     */     }
/*     */   }
/*     */
/*     */   public static enum DisplayType
/*     */   {
/*  33 */     Chat,
/*     */
/*  39 */     Scoreboard;
/*     */
/*     */     public static DisplayType resolve(String name)
/*     */     {
/*  49 */       name = name.toLowerCase();
/*  50 */       if (name.contains("chat")) {
/*  51 */         return Chat;
/*     */       }
/*     */
/*  54 */       if ((name.contains("score")) || (name.contains("board"))) {
/*  55 */         return Scoreboard;
/*     */       }
/*     */
/*  59 */       return Chat;
/*     */     }
/*     */   }
/*     */ }
Opublikowano

Usuń ostatnią klamrę:

package de.tobiyas.racesandclasses.playermanagement.display;

public interface Display
{
  public void display(double paramDouble1, double paramDouble2);
 
  public void unregister();
}

  public static enum DisplayInfos
  {
    MANA("MANA", ChatColor.WHITE, ChatColor.DARK_AQUA, ChatColor.BLUE),
    HEALTH("ZYCIE", ChatColor.RED, ChatColor.YELLOW, ChatColor.GREEN);
/*     */
/*     */     private final String name;
/*     */     private final ChatColor lowValueColor;
/*     */     private final ChatColor midValueColor;
/*     */     private final ChatColor highValueColor;
/*     */     private final boolean useName;
/*     */     private final boolean onlyUseOneValue;
/*     */
/*     */     private DisplayInfos(String name, ChatColor lowValueColor, ChatColor midValueColor, ChatColor highValueColor) {
/*  82 */       this(name, lowValueColor, midValueColor, highValueColor, false, false);
/*     */     }
/*     */
/*     */     private DisplayInfos(String name, ChatColor lowValueColor, ChatColor midValueColor, ChatColor highValueColor, boolean useName, boolean onlyUseOneValue)
/*     */     {
/*  87 */       this.name = name;
/*  88 */       this.lowValueColor = lowValueColor;
/*  89 */       this.midValueColor = midValueColor;
/*  90 */       this.highValueColor = highValueColor;
/*  91 */       this.useName = useName;
/*  92 */       this.onlyUseOneValue = onlyUseOneValue;
/*     */     }
/*     */
/*     */     public String getName() {
/*  96 */       return this.name;
/*     */     }
/*     */
/*     */     public ChatColor getLowValueColor()
    {
/* 100 */       return this.lowValueColor;
/*     */     }
/*     */
/*     */     public ChatColor getMidValueColor() {
/* 104 */       return this.midValueColor;
/*     */     }
/*     */
/*     */     public ChatColor getHighValueColor() {
/* 108 */       return this.highValueColor;
/*     */     }
/*     */
/*     */     public boolean useName() {
/* 112 */       return this.useName;
/*     */     }
/*     */
/*     */     public boolean onlyUseOneValue() {
/* 116 */       return this.onlyUseOneValue;
/*     */     }
/*     */   }
/*     */
/*     */   public static enum DisplayType
/*     */   {
/*  33 */     Chat,
/*     */
/*  39 */     Scoreboard;
/*     */
/*     */     public static DisplayType resolve(String name)
/*     */     {
/*  49 */       name = name.toLowerCase();
/*  50 */       if (name.contains("chat")) {
/*  51 */         return Chat;
/*     */       }
/*     */
/*  54 */       if ((name.contains("score")) || (name.contains("board"))) {
/*  55 */         return Scoreboard;
/*     */       }
/*     */
/*  59 */       return Chat;
/*     */     }
/*     */   }
/*     */ 
Opublikowano

To nie ma prawa działać. Tworzysz publiczne klasy wewnątrz pliku o innej nazwie. Do tego są statyczne. Prawdopodobnie chciałeś umieścić je jako wewnętrzne w tym interfejsie, wrzuć je do niego.

@blegger Ale z tym tłumaczeniem to pojechałeś >.<

708121422388637873334.png

Opublikowano

Jaca moglbys napisac na gg 44353207 i mi to objasnic bardziej ?

a co do publicznych klas to napoczatku byly abstrakcyjne chyba ;3

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...