generated from LabyMod/addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
4,651 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
core/src/main/java/tmb/randy/tmbgriefergames/core/IBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package tmb.randy.tmbgriefergames.core; | ||
|
||
import net.labymod.api.reference.annotation.Referenceable; | ||
|
||
@Referenceable | ||
public interface IBridge { | ||
public void startPlayerTracer(String name); | ||
public void cbChanged(); | ||
public boolean isFlyCountdownActive(); | ||
public String getWidgetString(); | ||
public String getItemRemoverValue(); | ||
} |
138 changes: 138 additions & 0 deletions
138
core/src/main/java/tmb/randy/tmbgriefergames/core/commands/DKsCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package tmb.randy.tmbgriefergames.core.commands; | ||
|
||
import net.labymod.api.client.chat.command.Command; | ||
import tmb.randy.tmbgriefergames.core.Addon; | ||
|
||
public class DKsCommand extends Command { | ||
|
||
private final String LEVELSTYLE = "§6"; | ||
private final String SEPARATORSTYLE = "§7"; | ||
|
||
public DKsCommand() { | ||
super("dks", "dk"); | ||
} | ||
@Override | ||
public boolean execute(String prefix, String[] arguments) { | ||
if(!Addon.isGG()) | ||
return false; | ||
|
||
int dksLevel7; | ||
int dksLevel6; | ||
int dksLevel5; | ||
int dksLevel4; | ||
int dksLevel3; | ||
int dksLevel2; | ||
int dksLevel1; | ||
|
||
if(arguments.length == 1) { | ||
String arg = arguments[0]; | ||
int numberOfDKs = Integer.parseInt(arg); | ||
|
||
if(numberOfDKs > 99999) { | ||
return true; | ||
} | ||
|
||
int itemsPerDK = 64*9*6; | ||
double restItems = numberOfDKs * itemsPerDK; | ||
double itemsForLevel; | ||
|
||
//Stufe 7 | ||
itemsForLevel = getItemsForLevel(7); | ||
dksLevel7 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel7); | ||
|
||
//Stufe 6 | ||
itemsForLevel = getItemsForLevel(6); | ||
dksLevel6 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel6); | ||
|
||
//Stufe 5 | ||
itemsForLevel = getItemsForLevel(5); | ||
dksLevel5 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel5); | ||
|
||
//Stufe 4 | ||
itemsForLevel = getItemsForLevel(4); | ||
dksLevel4 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel4); | ||
|
||
//Stufe 3 | ||
itemsForLevel = getItemsForLevel(3); | ||
dksLevel3 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel3); | ||
|
||
//Stufe 2 | ||
itemsForLevel = getItemsForLevel(2); | ||
dksLevel2 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel2); | ||
|
||
//Stufe 1 | ||
itemsForLevel = getItemsForLevel(1); | ||
dksLevel1 = (int)(restItems / itemsForLevel); | ||
restItems -= (itemsForLevel * dksLevel1); | ||
|
||
StringBuilder builder = new StringBuilder(); | ||
|
||
if(dksLevel7 > 0) { | ||
builder.append(LEVELSTYLE).append(dksLevel7).append(" * Ⅶ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(dksLevel6 > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(dksLevel6).append(" * Ⅵ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(dksLevel5 > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(dksLevel5).append(" * Ⅴ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(dksLevel4 > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(dksLevel4).append(" * Ⅳ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(dksLevel3 > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(dksLevel3).append(" * Ⅲ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(dksLevel2 > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(dksLevel2).append(" * Ⅱ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(dksLevel1 > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(dksLevel1).append(" * Ⅰ").append(SEPARATORSTYLE); | ||
} | ||
|
||
if(restItems > 0) { | ||
if(!builder.isEmpty()) { | ||
builder.append(" • "); | ||
} | ||
builder.append(LEVELSTYLE).append(restItems).append(" Items").append(SEPARATORSTYLE); | ||
} | ||
|
||
Addon.getSharedInstance().displayNotification("§e" + numberOfDKs + " DKs" + SEPARATORSTYLE + " = " + builder); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private double getItemsForLevel(int level) { | ||
return Math.pow(9, level); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
core/src/main/java/tmb/randy/tmbgriefergames/core/commands/PayAllCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package tmb.randy.tmbgriefergames.core.commands; | ||
|
||
import net.labymod.api.Laby; | ||
import net.labymod.api.client.chat.command.Command; | ||
import net.labymod.api.client.component.TextComponent; | ||
import net.labymod.api.client.scoreboard.Scoreboard; | ||
import net.labymod.api.client.scoreboard.ScoreboardTeam; | ||
import net.labymod.api.util.I18n; | ||
import tmb.randy.tmbgriefergames.core.Addon; | ||
|
||
public class PayAllCommand extends Command { | ||
public PayAllCommand() { | ||
super("pay"); | ||
} | ||
|
||
@Override | ||
public boolean execute(String prefix, String[] arguments) { | ||
if(!Addon.isGG()) | ||
return true; | ||
|
||
if(arguments.length == 2) { | ||
if((arguments[0].equals("**") || arguments[0].equals("/")) && Float.parseFloat(arguments[1]) >= 1F) { | ||
String playersString = getPlayersString(); | ||
int players = Integer.parseInt(playersString); | ||
if(players > 1) { | ||
float totalAmount = Float.parseFloat(arguments[1]); | ||
int perPlayer = (int) (totalAmount / (float) players); | ||
int realTotalAmount = players * perPlayer; | ||
|
||
if(perPlayer < 1) { | ||
Addon.getSharedInstance().displayNotification(I18n.getTranslation("tmbgriefergames.payAll.amountTooLow")); | ||
return false; | ||
} | ||
|
||
Laby.labyAPI().minecraft().chatExecutor().chat("/pay * " + perPlayer); | ||
Addon.getSharedInstance().displayNotification(I18n.getTranslation("tmbgriefergames.payAll.response", players, perPlayer, realTotalAmount)); | ||
} | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
private String getPlayersString() { | ||
Scoreboard scoreboard = Laby.labyAPI().minecraft().getScoreboard(); | ||
|
||
if(scoreboard == null) | ||
return ""; | ||
|
||
for (ScoreboardTeam team : scoreboard.getTeams()) { | ||
if(team.getTeamName().equals("online_value")) { | ||
String onlineString = ((TextComponent)team.getPrefix()).getText(); | ||
return onlineString.split("/")[0]; | ||
} | ||
} | ||
return ""; | ||
} | ||
} | ||
|
Oops, something went wrong.