Merge pull request #528 from Lucwousin/dcfhygvgasdnodagfsnohraoinpgaroinahrgdnoihardnoihrdnaiodrnhopadfnrshiapdfrnhiapndfrhds

Checkstyle, missed files/changes
This commit is contained in:
Tyler Bochard
2019-06-08 17:47:56 -04:00
committed by GitHub
4 changed files with 171 additions and 35 deletions

View File

@@ -8,4 +8,6 @@ jdk:
- openjdk8
- openjdk11
install: true
script: ./travis/build.sh
script: ./travis/build.sh
before_install:
- chmod +x ./travis/build.sh

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.inventorygrid;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("inventorygrid")
public interface InventoryGridConfig extends Config
{
@ConfigItem(
keyName = "showItem",
name = "Show item",
description = "Show a preview of the item in the new slot"
)
default boolean showItem()
{
return true;
}
@ConfigItem(
keyName = "showGrid",
name = "Show grid",
description = "Show a grid on the inventory while dragging"
)
default boolean showGrid()
{
return true;
}
@ConfigItem(
keyName = "showHighlight",
name = "Highlight background",
description = "Show a green background highlight on the new slot"
)
default boolean showHighlight()
{
return true;
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.inventorygrid;
import com.google.inject.Inject;
import com.google.inject.Provides;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Inventory Grid",
description = "Shows a grid over the inventory and a preview of where items will be dragged",
tags = {"items", "overlay"},
enabledByDefault = false
)
public class InventoryGridPlugin extends Plugin
{
@Inject
private InventoryGridOverlay overlay;
@Inject
private OverlayManager overlayManager;
@Override
public void startUp()
{
overlayManager.add(overlay);
}
@Override
public void shutDown()
{
overlayManager.remove(overlay);
}
@Provides
InventoryGridConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(InventoryGridConfig.class);
}
}

View File

@@ -27,22 +27,16 @@
package net.runelite.client.rs;
import net.runelite.api.Client;
import com.google.common.io.ByteStreams;
import io.sigpipe.jbsdiff.InvalidHeaderException;
import io.sigpipe.jbsdiff.Patch;
import java.applet.Applet;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
@@ -59,15 +53,11 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import static net.runelite.client.RuneLite.RUNELITE_DIR;
import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO;
import static net.runelite.client.rs.ClientUpdateCheckMode.CUSTOM;
import static net.runelite.client.rs.ClientUpdateCheckMode.NONE;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Request;
import okhttp3.Response;
import org.apache.commons.compress.compressors.CompressorException;
@Slf4j
@Singleton
@@ -155,25 +145,32 @@ public class ClientLoader
{
URL url = new URL("https://raw.githubusercontent.com/runelite-extended/maven-repo/master/artifacts/injected-client.jar");
ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream());
File LOCAL_INJECTED_CLIENT = new File("./injected-client/target/injected-client-"+RuneLiteAPI.getVersion()+".jar");
File INJECTED_CLIENT = new File(RUNELITE_DIR+"/injected-client.jar");
File LOCAL_INJECTED_CLIENT = new File("./injected-client/target/injected-client-" + RuneLiteAPI.getVersion() + ".jar");
File INJECTED_CLIENT = new File(RUNELITE_DIR + "/injected-client.jar");
INJECTED_CLIENT.mkdirs();
if (INJECTED_CLIENT.exists()) {
if (getFileSize(INJECTED_CLIENT.toURI().toURL())!= getFileSize(url)) {
if (INJECTED_CLIENT.exists())
{
if (getFileSize(INJECTED_CLIENT.toURI().toURL()) != getFileSize(url))
{
INJECTED_CLIENT.delete();
INJECTED_CLIENT.createNewFile();
System.out.println("Updating Injected Client");
updateInjectedClient(readableByteChannel);
}
} else {
}
else
{
INJECTED_CLIENT.createNewFile();
System.out.println("Initializing Inject Client");
updateInjectedClient(readableByteChannel);
}
JarInputStream fis;
if (useLocalInjected) {
if (useLocalInjected)
{
fis = new JarInputStream(new FileInputStream(LOCAL_INJECTED_CLIENT));
} else {
}
else
{
fis = new JarInputStream(new FileInputStream(INJECTED_CLIENT));
}
byte[] tmp = new byte[4096];
@@ -244,35 +241,43 @@ public class ClientLoader
}
}
private static int getFileSize(URL url) {
private static int getFileSize(URL url)
{
URLConnection conn = null;
try {
try
{
conn = url.openConnection();
if(conn instanceof HttpURLConnection) {
((HttpURLConnection)conn).setRequestMethod("HEAD");
if (conn instanceof HttpURLConnection)
{
((HttpURLConnection) conn).setRequestMethod("HEAD");
}
conn.getInputStream();
return conn.getContentLength();
} catch (IOException e) {
}
catch (IOException e)
{
throw new RuntimeException(e);
} finally {
if(conn instanceof HttpURLConnection) {
((HttpURLConnection)conn).disconnect();
}
finally
{
if (conn instanceof HttpURLConnection)
{
((HttpURLConnection) conn).disconnect();
}
}
}
private void updateInjectedClient(ReadableByteChannel readableByteChannel) {
File INJECTED_CLIENT = new File(RUNELITE_DIR,"injected-client.jar");
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(INJECTED_CLIENT);
FileChannel fileChannel = fileOutputStream.getChannel();
private void updateInjectedClient(ReadableByteChannel readableByteChannel)
{
File INJECTED_CLIENT = new File(RUNELITE_DIR, "injected-client.jar");
try
{
FileOutputStream fileOutputStream = new FileOutputStream(INJECTED_CLIENT);
fileOutputStream.getChannel()
.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
}
catch (IOException e)
{
e.printStackTrace();
}
}