Skip to content

Commit

Permalink
Uploaded Files
Browse files Browse the repository at this point in the history
  • Loading branch information
spiderfrog3000 authored Nov 20, 2016
1 parent cbec682 commit a6583b9
Show file tree
Hide file tree
Showing 16 changed files with 559 additions and 0 deletions.
59 changes: 59 additions & 0 deletions com/spiderfrog/lifeboat/Main.java
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);
}
}
22 changes: 22 additions & 0 deletions com/spiderfrog/lifeboat/Values.java
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";
}

}
36 changes: 36 additions & 0 deletions com/spiderfrog/lifeboat/items/DeathsModuleItem.java
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";
}
}
35 changes: 35 additions & 0 deletions com/spiderfrog/lifeboat/items/KillsModuleItem.java
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";
}
}
36 changes: 36 additions & 0 deletions com/spiderfrog/lifeboat/items/MapModuleItem.java
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";
}
}
35 changes: 35 additions & 0 deletions com/spiderfrog/lifeboat/items/ServerModuleItem.java
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";
}

}
35 changes: 35 additions & 0 deletions com/spiderfrog/lifeboat/items/TeamModuleItem.java
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";
}
}
35 changes: 35 additions & 0 deletions com/spiderfrog/lifeboat/items/TimeModuleItem.java
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";
}
}
25 changes: 25 additions & 0 deletions com/spiderfrog/lifeboat/server/lifeboatInstance.java
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");
}
}
65 changes: 65 additions & 0 deletions com/spiderfrog/lifeboat/statstranslation/DeutschDE.java
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) {}
}

}
Loading

0 comments on commit a6583b9

Please sign in to comment.