Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Leaderboard #19

Open
wants to merge 12 commits into
base: 1.6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2
jobs:
build:

working_directory: ~/Factions

docker:
- image: circleci/openjdk:8-jdk-browsers

steps:

- checkout

- restore_cache:
key: Factions-{{ checksum "pom.xml" }}

- run: mvn dependency:go-offline

- save_cache:
paths:
- ~/.m2
key: Factions-{{ checksum "pom.xml" }}

- run: mvn clean package

- store_artifacts:
path: target/Factions.jar
19 changes: 6 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# Eclipse stuff
/.classpath
/.project
/.settings

# NetBeans
.classpath
.project
.settings
/nbproject
/build.xml

# vim
.*.sw[a-p]

# various other potential build files
/build
/bin
/dist
/*.jardesc
/*.jar

# Mac filesystem dust
.DS_Store
/target/
/target
.idea
*.iml
15 changes: 0 additions & 15 deletions Factions1.6.iml

This file was deleted.

12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ You may also read the documentation ingame as the plugin ships with an ingame he
* `/f help 2`
* `/f help 3`

Note that you may optionally skip the slash and just write

* `f`

Installing
----------
1. Compile using github and Maven. Once this is stable I will release it.
1. Put Factions.jar in the plugins folder.
You can also download it here: https://mega.nz/#!3FlR2ZpJ!RkUljAttEVtZBF8RdearGkKjaWvH6rumHbMsIHEBWh0

A default config file will be created on the first run.

License
----------
This project has a LGPL license.<br>
Expand Down
20 changes: 12 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.massivecraft</groupId>
<artifactId>factions</artifactId>
<version>1.0-SNAPSHOT</version>
<artifactId>Factions</artifactId>
<version>1.8.0-Nukkit</version>
<build>
<sourceDirectory>src</sourceDirectory>
<finalName>Factions</finalName>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/resources</directory>
<includes>
<include>plugin.yml</include>
Expand All @@ -31,11 +33,10 @@
</build>
<repositories>
<repository>
<id>mengcraft</id>
<url>http://ci.mengcraft.com:8080/plugin/repository/everything/</url>
<id>nukkitx</id>
<url>https://repo.nukkitx.com/main/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>cn.nukkit</groupId>
Expand All @@ -46,8 +47,11 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.5</version>
<version>2.8.6</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
22 changes: 11 additions & 11 deletions src/com/massivecraft/factions/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@ public static ArrayList<String> getMap(Faction faction, FLocation flocation, dou
// For each row
for (int dz = 0; dz < height; dz++) {
// Draw and add that row
String row = "";
StringBuilder row = new StringBuilder();
for (int dx = 0; dx < width; dx++) {
if (dx == halfWidth && dz == halfHeight) {
row += TextFormat.AQUA + "+";
row.append(TextFormat.AQUA + "+");
} else {
FLocation flocationHere = topLeft.getRelative(dx, dz);
Faction factionHere = getFactionAt(flocationHere);
Relation relation = faction.getRelationTo(factionHere);
if (factionHere.isNone()) {
row += TextFormat.GRAY + "-";
row.append(TextFormat.GRAY + "-");
} else if (factionHere.isSafeZone()) {
row += Conf.colorPeaceful + "+";
row.append(Conf.colorPeaceful).append("+");
} else if (factionHere.isWarZone()) {
row += TextFormat.DARK_RED + "+";
row.append(TextFormat.DARK_RED + "+");
} else if
(
factionHere == faction
Expand All @@ -199,13 +199,13 @@ public static ArrayList<String> getMap(Faction faction, FLocation flocation, dou
if (!fList.containsKey(factionHere.getTag()))
fList.put(factionHere.getTag(), Conf.mapKeyChrs[chrIdx++]);
char tag = fList.get(factionHere.getTag());
row += factionHere.getColorTo(faction) + "" + tag;
row.append(factionHere.getColorTo(faction)).append(tag);
} else {
row += TextFormat.GRAY + "-";
row.append(TextFormat.GRAY + "-");
}
}
}
ret.add(row);
ret.add(row.toString());
}

// Get the compass
Expand All @@ -218,11 +218,11 @@ public static ArrayList<String> getMap(Faction faction, FLocation flocation, dou

// Add the faction key
if (Conf.showMapFactionKey) {
String fRow = "";
StringBuilder fRow = new StringBuilder();
for (String key : fList.keySet()) {
fRow += String.format("%s%s: %s ", TextFormat.GRAY, fList.get(key), key);
fRow.append(String.format("%s%s: %s ", TextFormat.GRAY, fList.get(key), key));
}
ret.add(fRow);
ret.add(fRow.toString());
}

return ret;
Expand Down
72 changes: 45 additions & 27 deletions src/com/massivecraft/factions/Conf.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public class Conf {
public static boolean canLeaveWithNegativePower = true;

// Configuration for faction-only chat
public static boolean factionOnlyChat = true;
public static boolean factionOnlyChat = false;
// Configuration on the Faction tag in chat messages.
public static boolean chatTagEnabled = true;
public static boolean chatTagEnabled = false;
public static transient boolean chatTagHandledByAnotherPlugin = false;
public static boolean chatTagRelationColored = true;
public static String chatTagReplaceString = "[FACTION]";
Expand Down Expand Up @@ -95,7 +95,7 @@ public class Conf {
public static boolean logLandClaims = true;
public static boolean logLandUnclaims = true;
public static boolean logMoneyTransactions = true;
public static boolean logPlayerCommands = true;
public static boolean logPlayerCommands = false;

// prevent some potential exploits
public static boolean handleExploitObsidianGenerators = true;
Expand Down Expand Up @@ -212,6 +212,8 @@ public class Conf {
public static boolean ownedMessageOnBorder = true;
public static boolean ownedMessageInsideTerritory = true;
public static boolean ownedMessageByChunk = false;
public static boolean factionHereMessage = true;
public static String factionHereMessageType = "tip"; // "tip", "popup", "actionbar" or "chat"

public static boolean pistonProtectionThroughDenyBuild = true;
//TODO Blocks are not enums they are static ints needs a large rewrite
Expand Down Expand Up @@ -315,25 +317,33 @@ public class Conf {
territoryProtectedMaterials.add(Block.CHEST);
territoryProtectedMaterials.add(Block.FURNACE);
territoryProtectedMaterials.add(Block.BURNING_FURNACE);
// territoryProtectedMaterials.add(Block.DISPENSER);
// territoryProtectedMaterials.add(Block.DIODE_BLOCK_OFF);
// territoryProtectedMaterials.add(Block.DIODE_BLOCK_ON);
// territoryProtectedMaterials.add(Block.JUKEBOX);
territoryProtectedMaterials.add(Block.DISPENSER);
territoryProtectedMaterials.add(Block.JUKEBOX);
territoryProtectedMaterials.add(Block.BREWING_STAND_BLOCK);
territoryProtectedMaterials.add(Block.ENCHANTMENT_TABLE);
// territoryProtectedMaterials.add(Block.CAULDRON);
territoryProtectedMaterials.add(Block.CAULDRON_BLOCK);
territoryProtectedMaterials.add(Block.FARMLAND);
// territoryProtectedMaterials.add(Block.BEACON);
territoryProtectedMaterials.add(Block.BEACON);
territoryProtectedMaterials.add(Block.ANVIL);
// territoryProtectedMaterials.add(Block.TRAPPED_CHEST);
// territoryProtectedMaterials.add(Block.DROPPER);
// territoryProtectedMaterials.add(Block.HOPPER);
territoryProtectedMaterials.add(Block.TRAPPED_CHEST);
territoryProtectedMaterials.add(Block.DROPPER);
territoryProtectedMaterials.add(Block.HOPPER_BLOCK);

// territoryDenyUseageMaterials.add(Item.FIREBALL);
territoryDenyUseageMaterials.add(Item.FLINT_AND_STEEL);
territoryDenyUseageMaterials.add(Item.BUCKET);
// territoryDenyUseageMaterials.add(Item.WATER_BUCKET);
// territoryDenyUseageMaterials.add(Item.LAVA_BUCKET);
territoryDenyUseageMaterials.add(Item.FIRE_CHARGE);
territoryDenyUseageMaterials.add(Item.NETHERITE_HOE);
territoryDenyUseageMaterials.add(Item.DIAMOND_HOE);
territoryDenyUseageMaterials.add(Item.IRON_HOE);
territoryDenyUseageMaterials.add(Item.GOLD_HOE);
territoryDenyUseageMaterials.add(Item.STONE_HOE);
territoryDenyUseageMaterials.add(Item.WOODEN_HOE);
territoryDenyUseageMaterials.add(Item.NETHERITE_SHOVEL);
territoryDenyUseageMaterials.add(Item.DIAMOND_SHOVEL);
territoryDenyUseageMaterials.add(Item.IRON_SHOVEL);
territoryDenyUseageMaterials.add(Item.GOLD_SHOVEL);
territoryDenyUseageMaterials.add(Item.STONE_SHOVEL);
territoryDenyUseageMaterials.add(Item.WOODEN_SHOVEL);

territoryProtectedMaterialsWhenOffline.add(Block.WOOD_DOOR_BLOCK);
territoryProtectedMaterialsWhenOffline.add(Block.IRON_DOOR_BLOCK);
Expand All @@ -347,25 +357,33 @@ public class Conf {
territoryProtectedMaterialsWhenOffline.add(Block.CHEST);
territoryProtectedMaterialsWhenOffline.add(Block.FURNACE);
territoryProtectedMaterialsWhenOffline.add(Block.BURNING_FURNACE);
// territoryProtectedMaterialsWhenOffline.add(Block.DISPENSER);
// territoryProtectedMaterialsWhenOffline.add(Block.DIODE_BLOCK_OFF);
// territoryProtectedMaterialsWhenOffline.add(Block.DIODE_BLOCK_ON);
// territoryProtectedMaterialsWhenOffline.add(Block.JUKEBOX);
territoryProtectedMaterialsWhenOffline.add(Block.DISPENSER);
territoryProtectedMaterialsWhenOffline.add(Block.JUKEBOX);
territoryProtectedMaterialsWhenOffline.add(Block.BREWING_STAND_BLOCK);
territoryProtectedMaterialsWhenOffline.add(Block.ENCHANTMENT_TABLE);
// territoryProtectedMaterialsWhenOffline.add(Block.CAULDRON);
territoryProtectedMaterialsWhenOffline.add(Block.CAULDRON_BLOCK);
territoryProtectedMaterialsWhenOffline.add(Block.FARMLAND);
// territoryProtectedMaterialsWhenOffline.add(Block.BEACON);
territoryProtectedMaterialsWhenOffline.add(Block.BEACON);
territoryProtectedMaterialsWhenOffline.add(Block.ANVIL);
// territoryProtectedMaterialsWhenOffline.add(Block.TRAPPED_CHEST);
// territoryProtectedMaterialsWhenOffline.add(Block.DROPPER);
// territoryProtectedMaterialsWhenOffline.add(Block.HOPPER);
territoryProtectedMaterialsWhenOffline.add(Block.TRAPPED_CHEST);
territoryProtectedMaterialsWhenOffline.add(Block.DROPPER);
territoryProtectedMaterialsWhenOffline.add(Block.HOPPER_BLOCK);

// territoryDenyUseageMaterialsWhenOffline.add(Item.FIREBALL);
territoryDenyUseageMaterialsWhenOffline.add(Item.FIRE_CHARGE);
territoryDenyUseageMaterialsWhenOffline.add(Item.FLINT_AND_STEEL);
territoryDenyUseageMaterialsWhenOffline.add(Item.BUCKET);
// territoryDenyUseageMaterialsWhenOffline.add(Item.WATER_BUCKET);
// territoryDenyUseageMaterialsWhenOffline.add(Item.LAVA_BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Item.NETHERITE_HOE);
territoryDenyUseageMaterialsWhenOffline.add(Item.DIAMOND_HOE);
territoryDenyUseageMaterialsWhenOffline.add(Item.IRON_HOE);
territoryDenyUseageMaterialsWhenOffline.add(Item.GOLD_HOE);
territoryDenyUseageMaterialsWhenOffline.add(Item.STONE_HOE);
territoryDenyUseageMaterialsWhenOffline.add(Item.WOODEN_HOE);
territoryDenyUseageMaterialsWhenOffline.add(Item.NETHERITE_SHOVEL);
territoryDenyUseageMaterialsWhenOffline.add(Item.DIAMOND_SHOVEL);
territoryDenyUseageMaterialsWhenOffline.add(Item.IRON_SHOVEL);
territoryDenyUseageMaterialsWhenOffline.add(Item.GOLD_SHOVEL);
territoryDenyUseageMaterialsWhenOffline.add(Item.STONE_SHOVEL);
territoryDenyUseageMaterialsWhenOffline.add(Item.WOODEN_SHOVEL);

// safeZoneNerfedCreatureTypes.add(Entity.BLAZE);
// safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER);
Expand Down
4 changes: 2 additions & 2 deletions src/com/massivecraft/factions/FLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public FLocation(FPlayer fplayer) {
}

public FLocation(Block block) {
this(block.getLevel().getName(), block.getFloorX(), block.getFloorZ());
this(block.getLevel().getName(), blockToChunk(block.getFloorX()), blockToChunk(block.getFloorZ()));
}

//----------------------------------------------//
Expand Down Expand Up @@ -191,4 +191,4 @@ public boolean equals(Object obj) {
FLocation that = (FLocation) obj;
return this.x == that.x && this.z == that.z && (this.worldName == null ? that.worldName == null : this.worldName.equals(that.worldName));
}
}
}
27 changes: 24 additions & 3 deletions src/com/massivecraft/factions/FPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public String getTag() {

public String getNameAndSomething(String something) {
String ret = this.role.getPrefix();
if (something.length() > 0) {
if (!something.isEmpty()) {
ret += something + " ";
}
ret += this.getName();
Expand Down Expand Up @@ -525,12 +525,33 @@ public boolean isInEnemyTerritory() {
}

public void sendFactionHereMessage() {
if (!Conf.factionHereMessage) {
return;
}
Faction factionHere = Board.getFactionAt(this.getLastStoodAt());
String msg = P.p.txt.parse("<i>") + " ~ " + factionHere.getTag(this);
if (factionHere.getDescription().length() > 0) {
if (!factionHere.getDescription().isEmpty()) {
msg += " - " + factionHere.getDescription();
}
this.sendMessage(msg);
Player player = this.getPlayer();
if (player != null) {
switch (Conf.factionHereMessageType) {
case "tip":
player.sendTip(msg);
break;
case "popup":
player.sendPopup(msg);
break;
case "actionbar":
player.sendActionBar(msg);
break;
case "chat":
player.sendMessage(msg);
break;
default:
player.sendMessage("§cERROR! Invalid factionHereMessageType. Must be 'tip', 'popup', 'actionbar' or 'chat'. Please report this to admin.");
}
}
}

// -------------------------------
Expand Down
Loading