Fixed 1.13 furnace name update, added help command.

This commit is contained in:
GB6 2019-02-27 15:13:14 +01:00
parent ad811314fd
commit 4a56cd7a8a
13 changed files with 141 additions and 128 deletions

View File

@ -19,4 +19,3 @@ build:
name: $name-$version
paths:
- "$path/*.jar"
- "$path/Read_this_before_your_first_use.txt"

View File

@ -1,20 +0,0 @@
Hey loves,
Thanks for downloading our instance ^_^ In order to
run it you will need a instance called arconix. It
basically takes a bunch of methods that we use all
over the place throughout our instance lineup and
stores it in one place so we don't have to write
new code every time we need to get something simple
done. So make sure to stay up to date with the latest
updates for it.
Link to download:
https://gitlab.com/Songoda/Arconix/-/jobs/artifacts/master/download?job=build
If you need help you can always join our
discord in which is listed at the bottom of all of
our instance pages.
Enjoy <3
Brianna & The Songoda Team.

View File

@ -58,13 +58,6 @@
</resources>
</build>
<repositories>
<repository>
<id>maven.sainttx.com</id>
<url>http://maven.sainttx.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
@ -72,84 +65,72 @@
<version>1.13.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl</groupId>
<artifactId>vault</artifactId>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
<artifactId>holographicdisplays</artifactId>
<version>LATEST</version>
<artifactId>holographicdisplays-api</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>manager</artifactId>
<artifactId>craftbukkit-1-13</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>craftbukkit-1-8</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>askyblock</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>griefprevention</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>kingdoms</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>plotsquared</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>towny</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>uskyblock</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>redprotect</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>factions</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>griefprevention</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>kingdoms</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>plotsquared</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>redprotect</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>towny</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>uskyblock</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>worldguard</artifactId>
@ -157,31 +138,16 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>worldguard6</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>craftbukkit-1-8</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>craftbukkit-1-13</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>craftbukkit-1-13</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
<groupId>net.milkbowl</groupId>
<artifactId>vault</artifactId>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -23,7 +23,7 @@ import java.util.stream.Collectors;
public class Locale {
private static final List<Locale> LOCALES = Lists.newArrayList();
private static final Pattern NODE_PATTERN = Pattern.compile("(\\w+(?:\\.{1}\\w+)*)\\s*=\\s*\"(.*)\"");
private static final Pattern NODE_PATTERN = Pattern.compile("(\\w+(?:\\.\\w+)*)\\s*=\\s*\"(.*)\"");
private static final String FILE_EXTENSION = ".lang";
private static JavaPlugin plugin;
private static File localeFolder;

View File

@ -31,6 +31,7 @@ public class CommandManager implements CommandExecutor {
addCommand(new CommandRemote(instance, commandEpicFurnaces));
addCommand(new CommandGive(instance, commandEpicFurnaces));
addCommand(new CommandBoost(instance, commandEpicFurnaces));
addCommand(new CommandHelp(instance, commandEpicFurnaces));
}
private AbstractCommand addCommand(AbstractCommand abstractCommand) {

View File

@ -17,7 +17,7 @@ public class CommandEpicFurnaces extends AbstractCommand {
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
sender.sendMessage("");
sender.sendMessage(StringUtils.formatText(instance.getLocale().getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
sender.sendMessage(StringUtils.formatText(instance.getLocale().getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oSongoda"));
for (AbstractCommand command : instance.getCommandManager().getCommands()) {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {

View File

@ -0,0 +1,46 @@
package com.songoda.epicfurnaces.command.commands;
import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.command.AbstractCommand;
import com.songoda.epicfurnaces.utils.StringUtils;
import org.bukkit.command.CommandSender;
public class CommandHelp extends AbstractCommand {
private final EpicFurnaces instance;
public CommandHelp(EpicFurnaces instance, AbstractCommand parent) {
super("help", parent, false);
this.instance = instance;
}
@Override
protected AbstractCommand.ReturnType runCommand(CommandSender sender, String... args) {
sender.sendMessage("");
sender.sendMessage(StringUtils.formatText(instance.getLocale().getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oSongoda"));
for (AbstractCommand command : instance.getCommandManager().getCommands()) {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
sender.sendMessage(StringUtils.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
}
}
sender.sendMessage("");
return ReturnType.SUCCESS;
}
@Override
public String getDescription() {
return "Displays the help page.";
}
@Override
public String getPermissionNode() {
return null;
}
@Override
public String getSyntax() {
return "/ef help";
}
}

View File

@ -4,20 +4,29 @@ import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.menus.OverviewMenu;
import com.songoda.epicfurnaces.utils.NMSUtil;
import com.songoda.epicfurnaces.utils.StringUtils;
import org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.v1_13_R2.block.CraftFurnace;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import static com.songoda.epicfurnaces.objects.FurnaceObject.BoostType.*;
import static com.songoda.epicfurnaces.objects.FurnaceObject.BoostType.FUEL_SHARE;
import static com.songoda.epicfurnaces.objects.FurnaceObject.BoostType.OVERHEAT;
/**
* Created by songoda on 3/7/2017.
@ -111,13 +120,12 @@ public class FurnaceObject {
BoostData boostData = instance.getBoostManager().getBoost(placedBy);
r = r * (boostData == null ? 1 : boostData.getMultiplier());
if (e.getResult() != null) {
e.getResult().setAmount(e.getResult().getAmount() + r);
if (e.getResult() == null) {
return;
}
// e.setResult(new ItemStack(e.getResult().getType(), r));
e.getResult().setAmount(e.getResult().getAmount() + r);
e.setResult(new ItemStack(e.getResult().getType(), r));
}
public void upgrade(String type, Player player) {
@ -177,17 +185,25 @@ public class FurnaceObject {
return;
}
String name = StringUtils.formatName(level.getLevel(), uses, false);
try {
Object craftFurnace = NMSUtil.getCraftClass("block.CraftFurnace").cast(location.getBlock().getState());
Field inventoryField = craftFurnace.getClass().getDeclaredField("furnace");
Method getTileEntity = craftFurnace.getClass().getDeclaredMethod("getTileEntity");
CraftFurnace craftFurnace = (CraftFurnace) location.getBlock().getState();
craftFurnace.setCustomName(name);
craftFurnace.update(true);
} catch (Exception e) {
try {
Object craftFurnace = NMSUtil.getCraftClass("block.CraftFurnace").cast(location.getBlock().getState());
Field inventoryField = craftFurnace.getClass().getDeclaredField("furnace");
Method getTileEntity = craftFurnace.getClass().getDeclaredMethod("getTileEntity");
inventoryField.setAccessible(true);
inventoryField.setAccessible(true);
Object tileEntity = getTileEntity.invoke(craftFurnace);
Method a = tileEntity.getClass().getDeclaredMethod("a", String.class);
a.invoke(tileEntity, StringUtils.formatName(level.getLevel(), uses, false));
} catch (Exception ignore) {
Object tileEntity = getTileEntity.invoke(craftFurnace);
Method a = tileEntity.getClass().getDeclaredMethod("a", String.class);
a.invoke(tileEntity, name);
} catch (Exception ignore) {
}
}
}

View File

@ -17,5 +17,11 @@
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -16,10 +16,10 @@
<dependencies>
<dependency>
<groupId>org.spigot</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1</version>
<scope>compile</scope>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -33,5 +33,4 @@ public interface ClaimableProtectionPluginHook extends ProtectionPluginHook {
* @return the unique String ID. null if no claim exists
*/
String getClaimID(String name);
}

View File

@ -21,7 +21,7 @@
<dependency>
<groupId>com</groupId>
<artifactId>plotsquared</artifactId>
<version>4</version>
<version>3.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -21,7 +21,7 @@
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>LATEST</version>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>