mirror of
https://github.com/songoda/UltimateRepairing.git
synced 2024-11-01 08:20:43 +01:00
Removed Arconix. Added Songoda Update
This commit is contained in:
parent
d52f11dfb8
commit
79e67adf2b
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateRepairing"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.1"
|
||||
version: "1.2"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
@ -19,4 +19,3 @@ build:
|
||||
name: $name-$version
|
||||
paths:
|
||||
- "$path/*.jar"
|
||||
- "$path/Read_this_before_your_first_use.txt"
|
||||
|
@ -1,20 +0,0 @@
|
||||
Hey loves,
|
||||
|
||||
Thanks for downloading our plugin ^_^ In order to
|
||||
use holograms with it you will need a plugin called
|
||||
arconix. It basically takes a bunch of methods that
|
||||
we use all over the place throughout our plugin 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 plugin pages.
|
||||
|
||||
Enjoy <3
|
||||
Brianna & The Songoda Team.
|
43
pom.xml
43
pom.xml
@ -17,26 +17,37 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
<artifactId>replacer</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<id>shaded</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>replace</goal>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.songoda:songodaupdater</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<file>${project.build.directory}/classes/plugin.yml</file>
|
||||
<replacements>
|
||||
<replacement>
|
||||
<token>maven-version-number</token>
|
||||
<value>${project.version}</value>
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@ -54,8 +65,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>arconix</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<artifactId>songodaupdater</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org</groupId>
|
||||
|
@ -11,11 +11,14 @@ import com.songoda.ultimaterepairing.events.PlayerListeners;
|
||||
import com.songoda.ultimaterepairing.handlers.ParticleHandler;
|
||||
import com.songoda.ultimaterepairing.handlers.RepairHandler;
|
||||
import com.songoda.ultimaterepairing.hologram.Hologram;
|
||||
import com.songoda.ultimaterepairing.hologram.HologramArconix;
|
||||
import com.songoda.ultimaterepairing.hologram.HologramHolographicDisplays;
|
||||
import com.songoda.ultimaterepairing.utils.ConfigWrapper;
|
||||
import com.songoda.ultimaterepairing.utils.Debugger;
|
||||
import com.songoda.ultimaterepairing.utils.Methods;
|
||||
import com.songoda.ultimaterepairing.utils.SettingsManager;
|
||||
import com.songoda.ultimaterepairing.utils.updateModules.LocaleModule;
|
||||
import com.songoda.update.Plugin;
|
||||
import com.songoda.update.SongodaUpdate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -23,14 +26,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
public final class UltimateRepairing extends JavaPlugin implements Listener {
|
||||
private static CommandSender console = Bukkit.getConsoleSender();
|
||||
@ -93,9 +88,10 @@ public final class UltimateRepairing extends JavaPlugin implements Listener {
|
||||
Locale.saveDefaultLocale("en_US");
|
||||
this.locale = Locale.getLocale(getConfig().getString("System.Language Mode", langMode));
|
||||
|
||||
if (getConfig().getBoolean("System.Download Needed Data Files")) {
|
||||
this.update();
|
||||
}
|
||||
//Running Songoda Updater
|
||||
Plugin plugin = new Plugin(this, 20);
|
||||
plugin.addModule(new LocaleModule());
|
||||
SongodaUpdate.load(plugin);
|
||||
|
||||
this.editor = new Editor(this);
|
||||
this.anvilManager = new AnvilManager();
|
||||
@ -109,8 +105,8 @@ public final class UltimateRepairing extends JavaPlugin implements Listener {
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
|
||||
// Register Hologram Plugin
|
||||
if (pluginManager.isPluginEnabled("Arconix"))
|
||||
hologram = new HologramArconix(this);
|
||||
if (pluginManager.isPluginEnabled("HolographicDisplays"))
|
||||
hologram = new HologramHolographicDisplays(this);
|
||||
|
||||
/*
|
||||
* Register anvils into AnvilManager from Configuration.
|
||||
@ -144,39 +140,6 @@ public final class UltimateRepairing extends JavaPlugin implements Listener {
|
||||
saveToFile();
|
||||
}
|
||||
|
||||
private void update() {
|
||||
try {
|
||||
URL url = new URL("http://update.songoda.com/index.php?plugin=" + getDescription().getName() + "&version=" + getDescription().getVersion());
|
||||
URLConnection urlConnection = url.openConnection();
|
||||
InputStream is = urlConnection.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
|
||||
int numCharsRead;
|
||||
char[] charArray = new char[1024];
|
||||
StringBuffer sb = new StringBuffer();
|
||||
while ((numCharsRead = isr.read(charArray)) > 0) {
|
||||
sb.append(charArray, 0, numCharsRead);
|
||||
}
|
||||
String jsonString = sb.toString();
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(jsonString);
|
||||
|
||||
JSONArray files = (JSONArray) json.get("neededFiles");
|
||||
for (Object o : files) {
|
||||
JSONObject file = (JSONObject) o;
|
||||
|
||||
switch ((String) file.get("type")) {
|
||||
case "locale":
|
||||
InputStream in = new URL((String) file.get("link")).openStream();
|
||||
Locale.saveDefaultLocale(in, (String) file.get("name"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed to update.");
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Saves registered kits to file.
|
||||
*/
|
||||
|
@ -330,7 +330,7 @@ public class RepairHandler {
|
||||
HashMap<Integer, ItemStack> items = player.getInventory().addItem(playerData.getToBeRepaired());
|
||||
|
||||
for (ItemStack item : items.values()) {
|
||||
player.getWorld().dropItemNaturally(p.getLocation(), item);
|
||||
player.getWorld().dropItemNaturally(player.getLocation(), item);
|
||||
}
|
||||
|
||||
playerData.getItem().remove();
|
||||
|
@ -1,47 +0,0 @@
|
||||
package com.songoda.ultimaterepairing.hologram;
|
||||
|
||||
import com.songoda.arconix.api.hologram.HologramObject;
|
||||
import com.songoda.arconix.plugin.Arconix;
|
||||
import com.songoda.ultimaterepairing.UltimateRepairing;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class HologramArconix extends Hologram {
|
||||
|
||||
private com.songoda.arconix.api.packets.Hologram hologramManager;
|
||||
|
||||
public HologramArconix(UltimateRepairing instance) {
|
||||
super(instance);
|
||||
this.hologramManager = Arconix.pl().getApi().packetLibrary.getHologramManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Location location, ArrayList<String> lines) {
|
||||
fixLocation(location);
|
||||
HologramObject hologram = new HologramObject(null, location, lines);
|
||||
hologramManager.addHologram(hologram);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Location location) {
|
||||
fixLocation(location);
|
||||
location.add(0, 0.25, 0);
|
||||
hologramManager.removeHologram(location, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Location location, ArrayList<String> lines) {
|
||||
remove(location.clone());
|
||||
fixLocation(location);
|
||||
HologramObject hologram = new HologramObject(null, location, lines);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(UltimateRepairing.getInstance(), () -> {
|
||||
hologramManager.addHologram(hologram);
|
||||
}, 1L);
|
||||
}
|
||||
|
||||
private void fixLocation(Location location) {
|
||||
location.add(0.5, 1.10, 0.5);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.songoda.ultimaterepairing.hologram;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
|
||||
import com.songoda.ultimaterepairing.UltimateRepairing;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class HologramHolographicDisplays extends Hologram {
|
||||
|
||||
|
||||
public HologramHolographicDisplays(UltimateRepairing instance) {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Location location, ArrayList<String> lines) {
|
||||
fixLocation(location);
|
||||
|
||||
com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(instance, location);
|
||||
for (String line : lines) {
|
||||
hologram.appendTextLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Location location) {
|
||||
fixLocation(location);
|
||||
for (com.gmail.filoghost.holographicdisplays.api.Hologram hologram : HologramsAPI.getHolograms(instance)) {
|
||||
if (hologram.getX() != location.getX()
|
||||
|| hologram.getY() != location.getY()
|
||||
|| hologram.getZ() != location.getZ()) continue;
|
||||
hologram.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Location location, ArrayList<String> lines) {
|
||||
fixLocation(location);
|
||||
for (com.gmail.filoghost.holographicdisplays.api.Hologram hologram : HologramsAPI.getHolograms(instance)) {
|
||||
if (hologram.getX() != location.getX()
|
||||
|| hologram.getY() != location.getY()
|
||||
|| hologram.getZ() != location.getZ()) continue;
|
||||
hologram.clearLines();
|
||||
for (String line : lines) {
|
||||
hologram.appendTextLine(line);
|
||||
}
|
||||
return;
|
||||
}
|
||||
add(location, lines);
|
||||
}
|
||||
|
||||
private void fixLocation(Location location) {
|
||||
location.add(.25, .95, .25);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.songoda.ultimaterepairing.utils.updateModules;
|
||||
|
||||
import com.songoda.ultimaterepairing.UltimateRepairing;
|
||||
import com.songoda.update.Module;
|
||||
import com.songoda.update.Plugin;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
public class LocaleModule implements Module {
|
||||
|
||||
@Override
|
||||
public void run(Plugin plugin) {
|
||||
JSONObject json = plugin.getJson();
|
||||
try {
|
||||
JSONArray files = (JSONArray) json.get("neededFiles");
|
||||
for (Object o : files) {
|
||||
JSONObject file = (JSONObject) o;
|
||||
|
||||
if (file.get("type").equals("locale")) {
|
||||
InputStream in = new URL((String) file.get("link")).openStream();
|
||||
UltimateRepairing.getInstance().getLocale().saveDefaultLocale(in, (String) file.get("name"));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
name: UltimateRepairing
|
||||
description: UltimateRepairing
|
||||
main: com.songoda.ultimaterepairing.UltimateRepairing
|
||||
softdepend: [Arconix, Vault]
|
||||
version: 1.1
|
||||
softdepend: [HolographicDisplays, Vault]
|
||||
version: maven-version-number
|
||||
author: Songoda
|
||||
api-version: 1.13
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user