Skip to content

Commit

Permalink
Merge pull request #1 from eirikh1996/Repair
Browse files Browse the repository at this point in the history
Repair
  • Loading branch information
eirikh1996 authored Jul 7, 2019
2 parents 5e7f084 + a75ace5 commit d3bc3d9
Show file tree
Hide file tree
Showing 64 changed files with 1,166 additions and 1,800 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Question
about: Ask a question about this project
title: ''
labels: question
assignees: ''

---


11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Please fill out the following before submitting your PR. -->
### Describe in detail what your pull request acomplishes

<!-- Delete if not aplicable -->
### Related issues:
-

### Checklist
- [ ] Unit tests <!-- if implementing API utilities -->
- [ ] Proper internationalization
- [ ] Compiled/tested
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ java -jar BuildTools.jar --rev 1.10.2
java -jar BuildTools.jar --rev 1.11.2
java -jar BuildTools.jar --rev 1.12.1
```
Download this repository as a zip file, then unzip the "movecraft-master".
In the "movecraft-master"-directory, locate the "libs" folder and add CraftBukkit 1.10 to 1.12 to it. Otherwise, Maven will be unable to be built.
Be sure to have Git Bash and Maven installed. Right-click in the "movecraft-master" directory, choose Git Bash here to open Git bash.

Then, run the following to build Movecraft through `maven`.
```
mvn clean instal
mvn clean install
```
Jars are located in `/target`.

Expand Down
8 changes: 1 addition & 7 deletions modules/Movecraft/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<version>7.0.0_Pre-Release-7</version>
<version>7.0.0_Pre-Release-8</version>

<repositories>
<repository>
Expand Down Expand Up @@ -59,12 +59,6 @@
<version>API</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.countercraft</groupId>
<artifactId>movecraft-WE6Utils</artifactId>
<version>WE6Utils</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import net.countercraft.movecraft.listener.BlockListener;
import net.countercraft.movecraft.listener.InteractListener;
import net.countercraft.movecraft.listener.PlayerListener;
import net.countercraft.movecraft.listener.WorldEditInteractListener;
import net.countercraft.movecraft.localisation.I18nSupport;
import net.countercraft.movecraft.mapUpdater.MapUpdateManager;
import net.countercraft.movecraft.repair.RepairManager;
Expand All @@ -44,7 +43,6 @@
import net.countercraft.movecraft.worldguard.WorldGuardCompatManager;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
Expand All @@ -54,7 +52,6 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -85,7 +82,6 @@ public class Movecraft extends JavaPlugin {
private AssaultManager assaultManager;
private SiegeManager siegeManager;
private RepairManager repairManager;
private MovecraftRepair movecraftRepair;

public static synchronized Movecraft getInstance() {
return instance;
Expand All @@ -112,13 +108,26 @@ public void onEnable() {
Settings.RestrictSiBsToRegions = getConfig().getBoolean("RestrictSiBsToRegions", false);
Settings.Debug = getConfig().getBoolean("Debug", false);
Settings.DisableSpillProtection = getConfig().getBoolean("DisableSpillProtection", false);

// moved localisation initialisation to the start so that startup messages can be localised
String[] localisations = {"en", "cz", "nl"};
for (String s : localisations) {
if (!new File(getDataFolder()
+ "/localisation/movecraftlang_" + s + ".properties").exists()) {
this.saveResource("localisation/movecraftlang_" + s + ".properties", false);
}
}

I18nSupport.init();


// if the PilotTool is specified in the config.yml file, use it
if (getConfig().getInt("PilotTool") != 0) {
logger.log(Level.INFO, "Recognized PilotTool setting of: "
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Recognized Pilot Tool")
+ getConfig().getInt("PilotTool"));
Settings.PilotTool = getConfig().getInt("PilotTool");
} else {
logger.log(Level.INFO, "No PilotTool setting, using default of 280");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - No Pilot Tool"));
}
// if the CompatibilityMode is specified in the config.yml file, use it.
// Otherwise set to false.
Expand All @@ -143,11 +152,11 @@ public void onEnable() {
}
} catch (final Exception e) {
e.printStackTrace();
this.getLogger().severe("Could not find support for this version.");
this.getLogger().severe(I18nSupport.getInternationalisedString("Startup - Version Not Supported"));
this.setEnabled(false);
return;
}
this.getLogger().info("Loading support for " + version);
this.getLogger().info(I18nSupport.getInternationalisedString("Startup - Loading Support") + " " + version);


Settings.SinkCheckTicks = getConfig().getDouble("SinkCheckTicks", 100.0);
Expand All @@ -162,6 +171,7 @@ public void onEnable() {
Settings.ProtectPilotedCrafts = getConfig().getBoolean("ProtectPilotedCrafts", false);
Settings.AllowCrewSigns = getConfig().getBoolean("AllowCrewSigns", true);
Settings.SetHomeToCrewSign = getConfig().getBoolean("SetHomeToCrewSign", true);
Settings.MaxRemoteSigns = getConfig().getInt("MaxRemoteSigns", -1);
Settings.RequireCreatePerm = getConfig().getBoolean("RequireCreatePerm", false);
Settings.RequireNamePerm = getConfig().getBoolean("RequireNamePerm", true);
Settings.TNTContactExplosives = getConfig().getBoolean("TNTContactExplosives", true);
Expand Down Expand Up @@ -207,12 +217,12 @@ public void onEnable() {
//load up WorldGuard if it's present
Plugin wGPlugin = getServer().getPluginManager().getPlugin("WorldGuard");
if (wGPlugin == null || !(wGPlugin instanceof WorldGuardPlugin)) {
logger.log(Level.INFO, "Movecraft did not find a compatible version of WorldGuard. Disabling WorldGuard integration");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - WG Not Found"));
Settings.SiegeEnable = false;
Settings.AssaultEnable = false;
Settings.RestrictSiBsToRegions = false;
} else {
logger.log(Level.INFO, "Found a compatible version of WorldGuard. Enabling WorldGuard integration");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - WG Found"));
Settings.WorldGuardBlockMoveOnBuildPerm = getConfig().getBoolean("WorldGuardBlockMoveOnBuildPerm", false);
Settings.WorldGuardBlockSinkOnPVPPerm = getConfig().getBoolean("WorldGuardBlockSinkOnPVPPerm", false);
logger.log(Level.INFO, "Settings: WorldGuardBlockMoveOnBuildPerm - {0}, WorldGuardBlockSinkOnPVPPerm - {1}", new Object[]{Settings.WorldGuardBlockMoveOnBuildPerm, Settings.WorldGuardBlockSinkOnPVPPerm});
Expand All @@ -223,25 +233,28 @@ public void onEnable() {
//load up WorldEdit if it's present
Plugin wEPlugin = getServer().getPluginManager().getPlugin("WorldEdit");
if (wEPlugin == null || !(wEPlugin instanceof WorldEditPlugin)) {
logger.log(Level.INFO, "Movecraft did not find a compatible version of WorldEdit. Disabling WorldEdit integration");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - WE Not Found"));
Settings.AssaultEnable = false;
} else {
logger.log(Level.INFO, "Found a compatible version of WorldEdit. Enabling WorldEdit integration");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - WE Found"));
Settings.RepairTicksPerBlock = getConfig().getInt("RepairTicksPerBlock", 0);
Settings.RepairMaxPercent = getConfig().getDouble("RepairMaxPercent", 50);
}
worldEditPlugin = (WorldEditPlugin) wEPlugin;

// next is Cannons
Plugin plug = getServer().getPluginManager().getPlugin("Cannons");
if (plug != null && plug instanceof Cannons) {
cannonsPlugin = (Cannons) plug;
logger.log(Level.INFO, "Found a compatible version of Cannons. Enabling Cannons integration");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Cannons Found"));
} else {
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Cannons Not Found"));
}
if (worldGuardPlugin != null && worldGuardPlugin instanceof WorldGuardPlugin) {
if (worldGuardPlugin.isEnabled()) {
Plugin tempWGCustomFlagsPlugin = getServer().getPluginManager().getPlugin("WGCustomFlags");
if (tempWGCustomFlagsPlugin != null && tempWGCustomFlagsPlugin instanceof WGCustomFlagsPlugin) {
logger.log(Level.INFO, "Found a compatible version of WGCustomFlags. Enabling WGCustomFlags integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - WGCF Found"));
wgCustomFlagsPlugin = (WGCustomFlagsPlugin) tempWGCustomFlagsPlugin;
WGCustomFlagsUtils WGCFU = new WGCustomFlagsUtils();
FLAG_PILOT = WGCFU.getNewStateFlag("movecraft-pilot", true);
Expand All @@ -258,13 +271,13 @@ public void onEnable() {
logger.log(Level.INFO, "Settings: WGCustomFlagsUseRotateFlag - {0}", Settings.WGCustomFlagsUseRotateFlag);
logger.log(Level.INFO, "Settings: WGCustomFlagsUseSinkFlag - {0}", Settings.WGCustomFlagsUseSinkFlag);
} else {
logger.log(Level.INFO, "Movecraft did not find a compatible version of WGCustomFlags. Disabling WGCustomFlags integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - WGCF Not Found"));
}
}
}
Plugin tempTownyPlugin = getServer().getPluginManager().getPlugin("Towny");
if (tempTownyPlugin != null && tempTownyPlugin instanceof Towny) {
logger.log(Level.INFO, "Found a compatible version of Towny. Enabling Towny integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Towny Found"));
townyPlugin = (Towny) tempTownyPlugin;
TownyUtils.initTownyConfig();
Settings.TownyBlockMoveOnSwitchPerm = getConfig().getBoolean("TownyBlockMoveOnSwitchPerm", false);
Expand All @@ -273,7 +286,7 @@ public void onEnable() {
logger.log(Level.INFO, "Settings: TownyBlockSinkOnNoPVP - {0}", Settings.TownyBlockSinkOnNoPVP);

} else {
logger.log(Level.INFO, "Movecraft did not find a compatible version of Towny. Disabling Towny integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Towny Not Found"));
}

Plugin tempEssentialsPlugin = getServer().getPluginManager().getPlugin("Essentials");
Expand All @@ -282,13 +295,13 @@ public void onEnable() {
if (tempEssentialsPlugin.getClass().getName().equals("com.earth2me.essentials.Essentials")) {
if (tempEssentialsPlugin instanceof Essentials) {
essentialsPlugin = (Essentials) tempEssentialsPlugin;
logger.log(Level.INFO, "Found a compatible version of Essentials. Enabling Essentials integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Essentials Found"));
}
}
}
}
if (essentialsPlugin == null) {
logger.log(Level.INFO, "Movecraft did not find a compatible version of Essentials. Disabling Essentials integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Essentials Not Found"));
}

// and now Vault
Expand All @@ -297,27 +310,19 @@ public void onEnable() {
if (rsp != null) {
economy = rsp.getProvider();
Settings.RepairMoneyPerBlock = getConfig().getDouble("RepairMoneyPerBlock", 0.0);
logger.log(Level.INFO, "Found a compatible Vault plugin.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Vault Found"));
} else {
logger.log(Level.INFO, "Could not find compatible Vault plugin. Disabling Vault integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Vault Not Found"));
economy = null;
Settings.SiegeEnable = false;
Settings.AssaultEnable = false;
}
} else {
logger.log(Level.INFO, "Could not find compatible Vault plugin. Disabling Vault integration.");
logger.log(Level.INFO, I18nSupport.getInternationalisedString("Startup - Vault Not Found"));
economy = null;
Settings.SiegeEnable = false;
}
String[] localisations = {"en", "cz", "nl"};
for (String s : localisations) {
if (!new File(getDataFolder()
+ "/localisation/movecraftlang_" + s + ".properties").exists()) {
this.saveResource("localisation/movecraftlang_" + s + ".properties", false);
}
}

I18nSupport.init();

if (shuttingDown && Settings.IGNORE_RESET) {
logger.log(
Level.SEVERE,
Expand Down Expand Up @@ -384,18 +389,10 @@ public void onEnable() {
getServer().getPluginManager().registerEvents(new InteractListener(), this);
if (worldEditPlugin != null) {
final Class clazz;
try {
clazz = Class.forName("net.countercraft.movecraft.compat.we6.IMovecraftRepair");
if (MovecraftRepair.class.isAssignableFrom(clazz)){
movecraftRepair = (MovecraftRepair) clazz.getConstructor().newInstance();
}
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
if (movecraftRepair != null){
MovecraftRepair.initialize(this);
if (MovecraftRepair.getInstance() != null){
repairManager = new RepairManager();
repairManager.runTaskTimerAsynchronously(this,0,1);
getServer().getPluginManager().registerEvents(new RepairSign(), this);
repairManager.runTaskTimerAsynchronously(this, 0, 1);
}
}
this.getCommand("movecraft").setExecutor(new MovecraftCommand());
Expand Down Expand Up @@ -431,7 +428,7 @@ public void onEnable() {
getServer().getPluginManager().registerEvents(new RelativeMoveSign(), this);
getServer().getPluginManager().registerEvents(new ReleaseSign(), this);
getServer().getPluginManager().registerEvents(new RemoteSign(), this);
//getServer().getPluginManager().registerEvents(new RepairSign(), this);
getServer().getPluginManager().registerEvents(new RepairSign(), this);
getServer().getPluginManager().registerEvents(new SpeedSign(), this);
getServer().getPluginManager().registerEvents(new StatusSign(), this);
getServer().getPluginManager().registerEvents(new SubcraftRotateSign(), this);
Expand Down Expand Up @@ -495,9 +492,5 @@ public WorldHandler getWorldHandler(){
public RepairManager getRepairManager() {
return repairManager;
}

public MovecraftRepair getMovecraftRepair() {
return movecraftRepair;
}
}

Loading

0 comments on commit d3bc3d9

Please sign in to comment.