Skip to content

Commit

Permalink
Release v1.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusAntons committed Nov 13, 2017
1 parent e047331 commit 90bf6e1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 47 deletions.
22 changes: 11 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.gradle.internal.os.OperatingSystem;
apply plugin: 'java'
apply plugin: 'idea'

def major = 1, minor = 4, patch = 4;
def major = 1, minor = 4, patch = 5

version = "$major.$minor.$patch"

Expand Down Expand Up @@ -60,30 +60,30 @@ repositories {
jcenter()
}

def minecraftFolder;
def minecraftFolder
if (OperatingSystem.current().isMacOsX()) {
minecraftFolder = "${System.properties['user.home']}/Library/Application Support/minecraft";
minecraftFolder = "${System.properties['user.home']}/Library/Application Support/minecraft"
} else if (OperatingSystem.current().isLinux()) {
minecraftFolder = "${System.properties['user.home']}/.minecraft";
minecraftFolder = "${System.properties['user.home']}/.minecraft"
} else if (OperatingSystem.current().isWindows()) {
minecraftFolder = "$System.env.APPDATA/.minecraft";
minecraftFolder = "$System.env.APPDATA/.minecraft"
} else {
throw new FileNotFoundException("No minecraft folder detected");
throw new FileNotFoundException("No minecraft folder detected")
}

def minecraftLibraries = fileTree(dir: "$minecraftFolder/libraries", include: '**/*.jar')

dependencies {
compile 'org.json:json:20170516'
compile 'org.json:json:20171018'
compile 'org.iq80.leveldb:leveldb:0.9'

// the following dependencies are provided at runtime by minecraft
compileOnly 'org.apache.httpcomponents:httpclient:4.5.3'
compileOnly 'com.google.code.gson:gson:2.8.1'
compileOnly 'org.apache.logging.log4j:log4j-api:2.9.0'
compileOnly 'com.google.guava:guava:23.0'
compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'org.apache.logging.log4j:log4j-api:2.9.1'
compileOnly 'com.google.guava:guava:23.4-jre'
compileOnly 'org.lwjgl.lwjgl:lwjgl:2.9.3'
compileOnly 'org.apache.commons:commons-lang3:3.6'
compileOnly 'org.apache.commons:commons-lang3:3.7'
compileOnly minecraftLibraries.matching { include '**/authlib-1.5.25.jar' }
compileOnly fileTree(dir: 'libs', include: 'The-5zig-API-*.jar')

Expand Down
25 changes: 1 addition & 24 deletions src/main/java/net/frozenbit/plugin5zig/cubecraft/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,38 +140,15 @@ public void onLoad(LoadEvent loadEvent) {
The5zigAPI.getAPI().registerModuleItem(this, "cubecraftstalker", StalkerItem.class, "cubecraft");
The5zigAPI.getAPI().registerModuleItem(this, "cubecraftassassinationmoney", MoneyItem.class, "cubecraft");
The5zigAPI.getAPI().registerModuleItem(this, "cubecraftduelsopponent", OpponentItem.class, "cubecraft");
The5zigAPI.getAPI().registerModuleItem(this, "cubecrafttowerdefencebanter", TowerBanterItem.class, "cubecraft");
//The5zigAPI.getAPI().registerModuleItem(this, "cubecrafttowerdefencebanter", TowerBanterItem.class, "cubecraft");

leaveKey = The5zigAPI.getAPI().registerKeyBiding("Leave the current game", Keyboard.KEY_L, "Cubecraft");
snakeKey = The5zigAPI.getAPI().registerKeyBiding("Toggle Snake", Keyboard.KEY_P, "Misc");
}

// copy the old skywars database - REMOVE THIS SOME TIME IN THE FUTURE!
migrateSkywarsDb();

instance = this;
}

private void migrateSkywarsDb() {
File source = new File("stalker.db");
File target = PLUGIN_PATH.resolve("stalker/Skywars.db").toFile();
if (source.isDirectory() && !target.isDirectory()) {
File[] db_files = source.listFiles();
if (db_files == null) {
getLogger().println("old skywars stalker.db exists but can not be read");
return;
}
try {
java.nio.file.Files.createDirectories(target.toPath());
for (File file : db_files) {
Files.copy(file, new File(target, file.getName()));
}
} catch (IOException e) {
getLogger().println(e);
}
}
}

@EventHandler
public void onJoin(ServerJoinEvent event) {
if (!pluginEnabled && ServerInstance.isCubeCraft(event.getHost())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void render(int x, int y, RenderLocation renderLocation, boolean dummy) {
return;
drawHeader(x, y);
int lineNumber = 1;
synchronized (stalkedPlayers) {
synchronized (getGameMode().getStalker().getStalkedPlayerList()) {
for (StalkedPlayer player : stalkedPlayers) {
if (player.getKills() == 0 && player.getDeaths() == 0)
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Stalker {
private String ownName;
private GameMode gameMode;
private final List<StalkedPlayer> stalkedPlayerList;
private final List<StalkedPlayer> provisionalStalkedPlayerList;
private final List<StalkedPlayer> internalStalkedPlayerList;
private int maxNameWidth = 0;
private int shownPlayerCount = 0;
private int playerListIteration = 0;
Expand All @@ -25,7 +25,7 @@ public Stalker(GameMode gameMode) {
storage = new Storage(gameMode);
ownName = The5zigAPI.getAPI().getGameProfile().getName();
stalkedPlayerList = new ArrayList<>();
provisionalStalkedPlayerList = new ArrayList<>();
internalStalkedPlayerList = new ArrayList<>();
}

public void onKill(String victim, String killer) {
Expand Down Expand Up @@ -62,19 +62,22 @@ public void onPlayerListUpdate(final List<CubeCraftPlayer> playerList) {
final int frozenPlayerListIteration = ++playerListIteration;
shownPlayerCount = 0;
new Thread(() -> {
provisionalStalkedPlayerList.clear();
synchronized (provisionalStalkedPlayerList) {
synchronized (internalStalkedPlayerList) {
internalStalkedPlayerList.clear();
for (CubeCraftPlayer cubeCraftPlayer : playerList) {
if (playerListIteration != frozenPlayerListIteration)
return;
maxNameWidth = Math.max(maxNameWidth, The5zigAPI.getAPI().getRenderHelper().getStringWidth(cubeCraftPlayer.getName()));
StalkedPlayer stalkedPlayer = storage.getStalkedPlayer(cubeCraftPlayer);
if (stalkedPlayer.getKills() != 0 || stalkedPlayer.getDeaths() != 0)
++shownPlayerCount;
provisionalStalkedPlayerList.add(stalkedPlayer);
internalStalkedPlayerList.add(stalkedPlayer);
}
if (playerListIteration != frozenPlayerListIteration)
return;
synchronized (stalkedPlayerList) {
stalkedPlayerList.addAll(provisionalStalkedPlayerList);
stalkedPlayerList.clear();
stalkedPlayerList.addAll(internalStalkedPlayerList);
}
}
}).start();
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/core/messages/cubecraft.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# will be accessible in this IPatternResult.
# Some expressions are already pre-defined and will be replaced by the mod: %p will match any valid
# Minecraft player name, %d will match any (positive or negative) integer.
generic.welcome=Welcome to CubeCraft Games!
generic.welcome=\u0020+
message.receive.friend=\\[Friend\\] (%p): .*
message.receive.pm=:.+: (%p) -> Me: .*
generic.playerList=There are %d players online: (.+)
generic.points=\\+(%d) points?
generic.join=%p joined the game\\. %d/%d
generic.left=(%p) left the game\\. %d/%d
generic.join=\\[\\+\\] %p joined your game \\(%d/%d\\).
generic.left=\\[-\\] (%p) left your game \\(%d/%d\\).
generic.kit=Selected kit (.+)
generic.death.fall=(%p) (?:fell to their death|couldn't fly)\\.?
generic.death.fire=(%p) (?:burned to death|burnt to a crisp)\\.?
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/lang/language_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ modules.item.cubecraftassassinationmoney=Money Assassinations
modules.item.cubecraftassassinationmoney.desc=Shows how much money you have in your inventory in Assassinations
modules.item.cubecraftduelsopponent=Opponent Duels
modules.item.cubecraftduelsopponent.desc=Shows the name and ping of the player you are fighting against Duels.
modules.item.cubecrafttowerdefencebanter=Tower prices
modules.item.cubecrafttowerdefencebanter.desc=Shows a list of all towers, their price and whether you have enough coins CubeCraft Tower Defence.
#modules.item.cubecrafttowerdefencebanter=Tower prices
#modules.item.cubecrafttowerdefencebanter.desc=Shows a list of all towers, their price and whether you have enough coins CubeCraft Tower Defence.
modules.item.snake=Snake game
modules.item.snake.desc=Play a game of snake! (toggle with P)
#
Expand Down

0 comments on commit 90bf6e1

Please sign in to comment.