-
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
1 parent
cbec682
commit a6583b9
Showing
16 changed files
with
559 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.spiderfrog.lifeboat; | ||
|
||
import com.spiderfrog.lifeboat.items.DeathsModuleItem; | ||
import com.spiderfrog.lifeboat.items.KillsModuleItem; | ||
import com.spiderfrog.lifeboat.items.MapModuleItem; | ||
import com.spiderfrog.lifeboat.items.ServerModuleItem; | ||
import com.spiderfrog.lifeboat.items.TeamModuleItem; | ||
import com.spiderfrog.lifeboat.items.TimeModuleItem; | ||
import com.spiderfrog.lifeboat.server.lifeboatInstance; | ||
import com.spiderfrog.lifeboat.statstranslation.DeutschDE; | ||
import com.spiderfrog.lifeboat.statstranslation.EnglishUS; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.event.ChatEvent; | ||
import eu.the5zig.mod.event.EventHandler; | ||
import eu.the5zig.mod.event.EventHandler.Priority; | ||
import eu.the5zig.mod.event.LoadEvent; | ||
import eu.the5zig.mod.event.PlayerListEvent; | ||
import eu.the5zig.mod.plugin.Plugin; | ||
|
||
@Plugin(name = "lifeboat-Support", version = "1.4") | ||
public class Main { | ||
|
||
@EventHandler(priority = Priority.NORMAL) | ||
public void onLoad(LoadEvent event) { | ||
The5zigAPI.getLogger().info("Load lifeboat Support!"); | ||
|
||
The5zigAPI.getAPI().registerServerInstance(this, lifeboatInstance.class); | ||
|
||
The5zigAPI.getAPI().registerModuleItem(this, "lifeboatMAP", MapModuleItem.class, "SERVER_LIFEBOAT"); | ||
The5zigAPI.getAPI().registerModuleItem(this, "lifeboatSERVER", ServerModuleItem.class, "SERVER_LIFEBOAT"); | ||
The5zigAPI.getAPI().registerModuleItem(this, "lifeboatTIME", TimeModuleItem.class, "SERVER_LIFEBOAT"); | ||
The5zigAPI.getAPI().registerModuleItem(this, "lifeboatKILLS", KillsModuleItem.class, "SERVER_LIFEBOAT"); | ||
The5zigAPI.getAPI().registerModuleItem(this, "lifeboatDEATHS", DeathsModuleItem.class, "SERVER_LIFEBOAT"); | ||
The5zigAPI.getAPI().registerModuleItem(this, "lifeboatTEAM", TeamModuleItem.class, "SERVER_LIFEBOAT"); | ||
|
||
The5zigAPI.getLogger().info("Loaded lifeboat Support!"); | ||
} | ||
|
||
@EventHandler(priority = Priority.HIGH) | ||
public void PlayerList(PlayerListEvent e) { | ||
|
||
if(e.getFooter() != null && The5zigAPI.getAPI().isInWorld()) | ||
{ | ||
Values.Server = e.getFooter().split(" ")[5].toString(); | ||
Values.Time = e.getFooter().split(" ")[3].toString(); | ||
} | ||
if(e.getHeader() != null && The5zigAPI.getAPI().isInWorld()) | ||
{ | ||
Values.mapName = e.getHeader().contains("by") ? e.getHeader().split("by")[0].toString() : e.getHeader().contains("von") ? e.getHeader().split("von")[0].toString(): "None"; | ||
} | ||
} | ||
|
||
@EventHandler(priority = Priority.HIGH) | ||
public void ClientChat(ChatEvent e) { | ||
EnglishUS.ClientChat(e); | ||
DeutschDE.ClientChat(e); | ||
} | ||
} |
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,22 @@ | ||
package com.spiderfrog.lifeboat; | ||
|
||
public class Values { | ||
|
||
public static String mapName = "None"; | ||
public static String Server = "None"; | ||
public static String Time = "00:00"; | ||
public static int kills = 0; | ||
public static int deaths = 0; | ||
public static String team = "None"; | ||
|
||
public static void resetValues() | ||
{ | ||
mapName = "None"; | ||
Server = "None"; | ||
Time = "00:00"; | ||
kills = 0; | ||
deaths = 0; | ||
team = "None"; | ||
} | ||
|
||
} |
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,36 @@ | ||
package com.spiderfrog.lifeboat.items; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.modules.AbstractModuleItem; | ||
import eu.the5zig.mod.render.RenderLocation; | ||
|
||
public class DeathsModuleItem extends AbstractModuleItem { | ||
|
||
@Override | ||
public void render(int x, int y, RenderLocation renderLocation, boolean dummy) { | ||
|
||
The5zigAPI.getAPI().getRenderHelper().drawString(getPrefix() + Values.deaths, x, y); | ||
} | ||
|
||
@Override | ||
public int getWidth(boolean dummy) { | ||
return The5zigAPI.getAPI().getRenderHelper().getStringWidth(getPrefix() + Values.deaths); | ||
} | ||
|
||
@Override | ||
public int getHeight(boolean dummy) { | ||
return 10; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Deaths"; | ||
} | ||
|
||
@Override | ||
public String getTranslation() { | ||
return "lifeboatdeaths"; | ||
} | ||
} |
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,35 @@ | ||
package com.spiderfrog.lifeboat.items; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.modules.AbstractModuleItem; | ||
import eu.the5zig.mod.render.RenderLocation; | ||
|
||
public class KillsModuleItem extends AbstractModuleItem { | ||
|
||
@Override | ||
public void render(int x, int y, RenderLocation renderLocation, boolean dummy) { | ||
|
||
The5zigAPI.getAPI().getRenderHelper().drawString(getPrefix() + Values.kills, x, y); | ||
} | ||
|
||
@Override | ||
public int getWidth(boolean dummy) { | ||
return The5zigAPI.getAPI().getRenderHelper().getStringWidth(getPrefix() + Values.kills); | ||
} | ||
|
||
@Override | ||
public int getHeight(boolean dummy) { | ||
return 10; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Kills"; | ||
} | ||
@Override | ||
public String getTranslation() { | ||
return "lifeboatkills"; | ||
} | ||
} |
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,36 @@ | ||
package com.spiderfrog.lifeboat.items; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.modules.AbstractModuleItem; | ||
import eu.the5zig.mod.render.RenderLocation; | ||
|
||
public class MapModuleItem extends AbstractModuleItem { | ||
|
||
@Override | ||
public void render(int x, int y, RenderLocation renderLocation, boolean dummy) { | ||
|
||
The5zigAPI.getAPI().getRenderHelper().drawString(getPrefix() + Values.mapName.replace("§b", "").replace("§l", "").replace("§8", ""), x, y); | ||
} | ||
|
||
@Override | ||
public int getWidth(boolean dummy) { | ||
return The5zigAPI.getAPI().getRenderHelper().getStringWidth(getPrefix() + Values.mapName.replace("§b", "").replace("§l", "").replace("§8", "")); | ||
} | ||
|
||
@Override | ||
public int getHeight(boolean dummy) { | ||
return 10; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Map"; | ||
} | ||
|
||
@Override | ||
public String getTranslation() { | ||
return "lifeboatmap"; | ||
} | ||
} |
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,35 @@ | ||
package com.spiderfrog.lifeboat.items; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.modules.AbstractModuleItem; | ||
import eu.the5zig.mod.render.RenderLocation; | ||
|
||
public class ServerModuleItem extends AbstractModuleItem { | ||
|
||
@Override | ||
public int getHeight(boolean arg0) { | ||
return 10; | ||
} | ||
|
||
@Override | ||
public int getWidth(boolean arg0) { | ||
return The5zigAPI.getAPI().getRenderHelper().getStringWidth(getPrefix() + Values.Server); | ||
} | ||
|
||
@Override | ||
public void render(int x, int y, RenderLocation renderLocation, boolean dummy) { | ||
The5zigAPI.getAPI().getRenderHelper().drawString(getPrefix() + Values.Server.replace("§f", "").replace("§l", ""), x, y); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Server"; | ||
} | ||
@Override | ||
public String getTranslation() { | ||
return "lifeboatserver"; | ||
} | ||
|
||
} |
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,35 @@ | ||
package com.spiderfrog.lifeboat.items; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.modules.AbstractModuleItem; | ||
import eu.the5zig.mod.render.RenderLocation; | ||
|
||
public class TeamModuleItem extends AbstractModuleItem { | ||
@Override | ||
public void render(int x, int y, RenderLocation renderLocation, boolean dummy) { | ||
|
||
The5zigAPI.getAPI().getRenderHelper().drawString(getPrefix() + Values.team, x, y); | ||
} | ||
|
||
@Override | ||
public int getWidth(boolean dummy) { | ||
return The5zigAPI.getAPI().getRenderHelper().getStringWidth(getPrefix() + Values.team); | ||
} | ||
|
||
@Override | ||
public int getHeight(boolean dummy) { | ||
return 10; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Team"; | ||
} | ||
|
||
@Override | ||
public String getTranslation() { | ||
return "lifeboatteam"; | ||
} | ||
} |
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,35 @@ | ||
package com.spiderfrog.lifeboat.items; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigAPI; | ||
import eu.the5zig.mod.modules.AbstractModuleItem; | ||
import eu.the5zig.mod.render.RenderLocation; | ||
|
||
public class TimeModuleItem extends AbstractModuleItem { | ||
|
||
@Override | ||
public int getHeight(boolean arg0) { | ||
return 10; | ||
} | ||
|
||
@Override | ||
public int getWidth(boolean arg0) { | ||
return The5zigAPI.getAPI().getRenderHelper().getStringWidth(getPrefix() + Values.Time); | ||
} | ||
|
||
@Override | ||
public void render(int x, int y, RenderLocation renderLocation, boolean dummy) { | ||
The5zigAPI.getAPI().getRenderHelper().drawString(getPrefix() + Values.Time.replace("§a", "").replace("§8", "").replace("§6", ""), x, y); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Time"; | ||
} | ||
|
||
@Override | ||
public String getTranslation() { | ||
return "lifeboattime"; | ||
} | ||
} |
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,25 @@ | ||
package com.spiderfrog.lifeboat.server; | ||
|
||
import eu.the5zig.mod.server.ServerInstance; | ||
|
||
public class lifeboatInstance extends ServerInstance { | ||
|
||
@Override | ||
public void registerListeners() { | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "PC-Lifeboat"; | ||
} | ||
|
||
@Override | ||
public String getConfigName() { | ||
return "lifeboat"; | ||
} | ||
|
||
@Override | ||
public boolean handleServer(String host, int port) { | ||
return host.equals("us.oc.tc") || host.equals("oc.tc") || host.equals("pc.lbsg.net") || host.equals("eu.oc.tc"); | ||
} | ||
} |
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,65 @@ | ||
package com.spiderfrog.lifeboat.statstranslation; | ||
|
||
import com.spiderfrog.lifeboat.Values; | ||
|
||
import eu.the5zig.mod.The5zigMod; | ||
import eu.the5zig.mod.event.ChatEvent; | ||
|
||
public class DeutschDE { | ||
|
||
public static void ClientChat(ChatEvent e) { | ||
String message = e.getMessage().replace("§a", "").replace("§b", "").replace("§c", "").replace("§d", "").replace("§e", "").replace("§f", "").replace("§1", "").replace("§2", "").replace("§3", "").replace("§4", "").replace("§5", "").replace("§6", "").replace("§7", "").replace("§8", "").replace("§9", "").replace("§0", "").replace("§l", "").replace("§m", "").replace("§o", "").replace("§k", "").replace("§n", "").replace("§r", ""); | ||
if(message.contains("Willkommen auf dem lifeboat Network")) | ||
{ | ||
Values.resetValues(); | ||
Values.Server = "Lobby"; | ||
} | ||
if(message.startsWith("Das Spiel hat begonnen!") || message.startsWith("Du wirst [")) | ||
{ | ||
Values.kills = 0; | ||
Values.deaths = 0; | ||
} | ||
|
||
String name = The5zigMod.getDataManager().getUsername(); | ||
try | ||
{ | ||
if(message.contains(name)) | ||
{ | ||
if(message.contains("wurde von " + name)) | ||
{ | ||
++Values.kills; | ||
} | ||
if(message.contains("wurde durch " + name)) | ||
{ | ||
++Values.kills; | ||
} | ||
if(message.contains(name + " wurde von")) | ||
{ | ||
++Values.deaths; | ||
} | ||
if(message.contains(name + " wurde durch")) | ||
{ | ||
++Values.deaths; | ||
} | ||
if(message.contains(name + " ist aus einer Höhe von")) | ||
{ | ||
++Values.deaths; | ||
} | ||
if(message.contains(name + " ist aus der Welt gefallen")) | ||
{ | ||
++Values.deaths; | ||
} | ||
if(message.contains(name + " ist von einem hohen Ort heruntergefallen")) | ||
{ | ||
++Values.deaths; | ||
} | ||
if(message.contains(name + " hat den Boden aus einer Höhe von")) | ||
{ | ||
++Values.deaths; | ||
} | ||
} | ||
} | ||
catch(Exception err) {} | ||
} | ||
|
||
} |
Oops, something went wrong.