From 3d2fa058ff8de2efcc24f5d802b8aba24d24ee30 Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:39:00 +0100 Subject: [PATCH 1/5] Update gradle.properties --- gradle.properties | 84 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 44a03b6..6640275 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,13 +15,27 @@ autoUpdateBuildScript = false minecraftVersion = 1.7.10 forgeVersion = 10.13.4.1614 +# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task. +channel = stable +mappingsVersion = 12 + +# Define other MCP mappings for dependency deobfuscation +remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ + # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you # restart Minecraft in development. Choose this dependent on your mod: # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty developmentEnvironmentUserName = Developer -# Define a source file of your project with: +# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8. +# See https://github.com/bsideup/jabel for details on how this works. +enableModernJavaSyntax = true + +# Enables injecting missing generics into the decompiled source code for a better coding experience +# Turns most publicly visible List, Map, etc. into proper List, Map types +enableGenericInjection = true + # public static final String VERSION = "GRADLETOKEN_VERSION"; # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]) @@ -38,11 +52,14 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME apiPackage = opis.api # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ -# Example value: mymodid_at.cfg +# There can be multiple files in a space-separated list. +# Example value: mymodid_at.cfg nei_at.cfg accessTransformersFile = mobius_at.cfg # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false +# Adds some debug arguments like verbose output and export +usesMixinDebug = false # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. mixinPlugin = # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! @@ -55,6 +72,9 @@ coreModClass = mobiuscore.asm.CoreDescription # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! containsMixinsAndOrCoreModOnly = false +# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. +forceEnableMixins = false + # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # responsibility check the licence and request permission for distribution, if required. usesShadowedDependencies = true @@ -64,9 +84,65 @@ minimizeShadowedDependencies = false # If disabled, won't rename the shadowed classes. relocateShadowedDependencies = true +# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories +includeWellKnownRepositories = true + +# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven. +# Authenticate with the MAVEN_USERNAME and MAVEN_PASSWORD environment variables. +# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle. +usesMavenPublishing = true +# mavenPublishUrl = http://jenkins.usrv.eu:8081/nexus/content/repositories/releases + +# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token. + +# The project's ID on Modrinth. Can be either the slug or the ID. +# Leave this empty if you don't want to publish on Modrinth. +modrinthProjectId = + +# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. +# Syntax: scope1-type1:name1;scope2-type2:name2;... +# Where scope can be one of [required, optional, incompatible, embedded], +# type can be one of [project, version], +# and the name is the Modrinth project or version slug/id of the other mod. +# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech +# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +modrinthRelations = + + +# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. + +# The project's numeric ID on CurseForge. You can find this in the About Project box. +# Leave this empty if you don't want to publish on CurseForge. +curseForgeProjectId = + +# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. +# Syntax: type1:name1;type2:name2;... +# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], +# and the name is the CurseForge project slug of the other mod. +# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft +# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +curseForgeRelations = + + # Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older # projects. New projects should not use this parameter. -#customArchiveBaseName = +# customArchiveBaseName = # Optional parameter to prevent the source code from being published -# noPublishedSources = +# noPublishedSources = + +# Uncomment this to disable spotless checks +# This should only be uncommented to keep it easier to sync with upstream/other forks. +# That is, if there is no other active fork/upstream, NEVER change this. +# disableSpotless = true + +# Uncomment this to disable checkstyle checks (currently wildcard import check). +# disableCheckstyle = true + +# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle" +# (force use delegated build). +# This is meant to be set in $HOME/.gradle/gradle.properties. +# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build. +# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want! +# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you. +# ideaOverrideBuildType = idea From 2bd01346236cb07ea90359e75b861e69e8ee865d Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:09:41 +0100 Subject: [PATCH 2/5] Add missing `serialVersionUID`s --- .../mcp/mobius/mobiuscore/monitors/MonitoredEntityList.java | 1 + .../java/mcp/mobius/mobiuscore/monitors/MonitoredList.java | 2 ++ .../java/mcp/mobius/mobiuscore/monitors/MonitoredTileList.java | 1 + src/main/java/mcp/mobius/opis/gui/helpers/UIException.java | 2 ++ src/main/java/mcp/mobius/opis/swing/SwingUI.java | 2 ++ src/main/java/mcp/mobius/opis/swing/panels/PanelSummary.java | 1 + .../opis/swing/panels/debug/PanelOrphanTileEntities.java | 1 + .../java/mcp/mobius/opis/swing/panels/debug/PanelThreads.java | 2 ++ .../mcp/mobius/opis/swing/panels/network/PanelInbound.java | 2 ++ .../mcp/mobius/opis/swing/panels/network/PanelInbound250.java | 2 ++ .../mcp/mobius/opis/swing/panels/network/PanelOutbound.java | 2 ++ .../mcp/mobius/opis/swing/panels/network/PanelOutbound250.java | 2 ++ .../opis/swing/panels/timingclient/PanelEventClient.java | 1 + .../opis/swing/panels/timingclient/PanelRenderEntities.java | 1 + .../opis/swing/panels/timingclient/PanelRenderHandlers.java | 1 + .../opis/swing/panels/timingclient/PanelRenderTileEnts.java | 1 + .../opis/swing/panels/timingserver/PanelTimingChunks.java | 1 + .../opis/swing/panels/timingserver/PanelTimingEntities.java | 1 + .../swing/panels/timingserver/PanelTimingEntitiesPerClass.java | 1 + .../opis/swing/panels/timingserver/PanelTimingEvents.java | 1 + .../opis/swing/panels/timingserver/PanelTimingHandlers.java | 1 + .../opis/swing/panels/timingserver/PanelTimingTileEnts.java | 1 + .../swing/panels/timingserver/PanelTimingTileEntsPerClass.java | 1 + .../mobius/opis/swing/panels/tracking/PanelAmountEntities.java | 1 + .../mobius/opis/swing/panels/tracking/PanelAmountTileEnts.java | 1 + .../mcp/mobius/opis/swing/panels/tracking/PanelDimensions.java | 1 + .../mcp/mobius/opis/swing/panels/tracking/PanelPlayers.java | 1 + src/main/java/mcp/mobius/opis/swing/widgets/JButtonAccess.java | 1 + .../java/mcp/mobius/opis/swing/widgets/JPanelMsgHandler.java | 1 + src/main/java/mcp/mobius/opis/swing/widgets/JTableButton.java | 1 + src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java | 3 +++ 31 files changed, 41 insertions(+) diff --git a/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredEntityList.java b/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredEntityList.java index 82dba5f..cb67ec4 100644 --- a/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredEntityList.java +++ b/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredEntityList.java @@ -9,6 +9,7 @@ public class MonitoredEntityList extends MonitoredList { + private static final long serialVersionUID = 9184692038032137709L; private Map count = new HashMap(); @Override diff --git a/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredList.java b/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredList.java index 5a4cfd8..d91e8d3 100644 --- a/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredList.java +++ b/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredList.java @@ -5,6 +5,8 @@ public abstract class MonitoredList extends ArrayList { + private static final long serialVersionUID = 8542841497500505801L; + abstract void addCount(E e); abstract void removeCount(int index); diff --git a/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredTileList.java b/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredTileList.java index 83cd4e3..71a4a47 100644 --- a/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredTileList.java +++ b/src/main/java/mcp/mobius/mobiuscore/monitors/MonitoredTileList.java @@ -14,6 +14,7 @@ public class MonitoredTileList extends MonitoredList { + private static final long serialVersionUID = -2243048028307261560L; // private Map count = new HashMap(); private Table count = HashBasedTable.create(); private Map blockdata = new WeakHashMap<>(); diff --git a/src/main/java/mcp/mobius/opis/gui/helpers/UIException.java b/src/main/java/mcp/mobius/opis/gui/helpers/UIException.java index 47fb631..98217cd 100644 --- a/src/main/java/mcp/mobius/opis/gui/helpers/UIException.java +++ b/src/main/java/mcp/mobius/opis/gui/helpers/UIException.java @@ -2,6 +2,8 @@ public class UIException extends RuntimeException { + private static final long serialVersionUID = -8883516752828603623L; + public UIException(String message) { super(message); } diff --git a/src/main/java/mcp/mobius/opis/swing/SwingUI.java b/src/main/java/mcp/mobius/opis/swing/SwingUI.java index 65a133a..4237417 100644 --- a/src/main/java/mcp/mobius/opis/swing/SwingUI.java +++ b/src/main/java/mcp/mobius/opis/swing/SwingUI.java @@ -34,6 +34,8 @@ public class SwingUI extends JFrame implements WindowListener, ChangeListener, IMessageHandler { + private static final long serialVersionUID = 2511764540016284809L; + public static HashSet registeredButtons = new HashSet(); private static SwingUI _instance = new SwingUI(); diff --git a/src/main/java/mcp/mobius/opis/swing/panels/PanelSummary.java b/src/main/java/mcp/mobius/opis/swing/panels/PanelSummary.java index d09bfad..efa2848 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/PanelSummary.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/PanelSummary.java @@ -45,6 +45,7 @@ public class PanelSummary extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = -7829545857856726718L; private JLabel lblTimingWorldTick; private JLabel lblTimingTileEnts; private JLabel lblTimingEntities; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelOrphanTileEntities.java b/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelOrphanTileEntities.java index c342b14..90b32dd 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelOrphanTileEntities.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelOrphanTileEntities.java @@ -22,6 +22,7 @@ public class PanelOrphanTileEntities extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = -341445520997162044L; private JButtonAccess btnRefresh; public PanelOrphanTileEntities() { diff --git a/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelThreads.java b/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelThreads.java index f57e501..cf14023 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelThreads.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/debug/PanelThreads.java @@ -18,6 +18,8 @@ public class PanelThreads extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = -1780112855406946574L; + public PanelThreads() { setLayout(new MigLayout("", "[grow]", "[grow]")); diff --git a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound.java b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound.java index ef268fd..94a929a 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound.java @@ -20,6 +20,8 @@ public class PanelInbound extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 8059336351920585340L; + public PanelInbound() { setLayout(new MigLayout("", "[grow]", "[grow]")); diff --git a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound250.java b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound250.java index 45e1e49..d206538 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound250.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelInbound250.java @@ -21,6 +21,8 @@ public class PanelInbound250 extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 8477181689374526988L; + public PanelInbound250() { setLayout(new MigLayout("", "[grow]", "[grow]")); diff --git a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound.java b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound.java index e411a36..f2f815e 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound.java @@ -20,6 +20,8 @@ public class PanelOutbound extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = -6784989728196791048L; + public PanelOutbound() { setLayout(new MigLayout("", "[grow]", "[grow]")); diff --git a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound250.java b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound250.java index 01f6258..c84a8ff 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound250.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/network/PanelOutbound250.java @@ -21,6 +21,8 @@ public class PanelOutbound250 extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = -1680266431743066076L; + public PanelOutbound250() { setLayout(new MigLayout("", "[grow]", "[grow]")); diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelEventClient.java b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelEventClient.java index 1960a08..f36b056 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelEventClient.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelEventClient.java @@ -25,6 +25,7 @@ public class PanelEventClient extends JPanel implements ITabPanel, IMessageHandler { + private static final long serialVersionUID = -1580335760456742927L; private JTableStats table; private JButton btnRunRender; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderEntities.java b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderEntities.java index 47fb501..1bef5af 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderEntities.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderEntities.java @@ -24,6 +24,7 @@ public class PanelRenderEntities extends JPanel implements ITabPanel, IMessageHandler { + private static final long serialVersionUID = 2560212471352620985L; private JTableStats table; private JButton btnRunRender; private JLabel lblTotal; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderHandlers.java b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderHandlers.java index 80a037f..3acd8d4 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderHandlers.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderHandlers.java @@ -23,6 +23,7 @@ public class PanelRenderHandlers extends JPanel implements ITabPanel, IMessageHandler { + private static final long serialVersionUID = 1797880239043030023L; private JTableStats table; private JButton btnRunRender; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderTileEnts.java b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderTileEnts.java index 5afe488..7975d90 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderTileEnts.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingclient/PanelRenderTileEnts.java @@ -25,6 +25,7 @@ public class PanelRenderTileEnts extends JPanel implements ITabPanel, IMessageHandler { + private static final long serialVersionUID = -1643399328582311507L; private JTableStats table; private JButton btnRunRender; private JLabel lblTotal; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingChunks.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingChunks.java index acbccb7..8eef943 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingChunks.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingChunks.java @@ -22,6 +22,7 @@ public class PanelTimingChunks extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 369552148126824481L; private JButtonAccess btnRun; private JButtonAccess btnTeleport; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntities.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntities.java index 51fdcc6..b7ca341 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntities.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntities.java @@ -23,6 +23,7 @@ public class PanelTimingEntities extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 2091306769787585128L; private JButtonAccess btnRun; private JButtonAccess btnPull; private JButtonAccess btnTeleport; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntitiesPerClass.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntitiesPerClass.java index 83ce2a1..6508be1 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntitiesPerClass.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEntitiesPerClass.java @@ -23,6 +23,7 @@ public class PanelTimingEntitiesPerClass extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 5283880266511919273L; private JButtonAccess btnRun; public PanelTimingEntitiesPerClass() { diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEvents.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEvents.java index 415a433..342df1a 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEvents.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingEvents.java @@ -23,6 +23,7 @@ public class PanelTimingEvents extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 762721479549422969L; private JButtonAccess btnRun; public PanelTimingEvents() { diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingHandlers.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingHandlers.java index 5ebb4d2..e6052c4 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingHandlers.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingHandlers.java @@ -23,6 +23,7 @@ public class PanelTimingHandlers extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = -5484173224998075653L; private JButtonAccess btnRun; private JLabel lblSummary; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEnts.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEnts.java index 3583ed6..2dcacdc 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEnts.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEnts.java @@ -26,6 +26,7 @@ public class PanelTimingTileEnts extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 5062513693524867972L; private JButtonAccess btnTeleport; private JButtonAccess btnReset; private JButtonAccess btnRun; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEntsPerClass.java b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEntsPerClass.java index 4ce6ec0..c1ce2ac 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEntsPerClass.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/timingserver/PanelTimingTileEntsPerClass.java @@ -25,6 +25,7 @@ public class PanelTimingTileEntsPerClass extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 4418291080888474821L; private JButtonAccess btnRun; public PanelTimingTileEntsPerClass() { diff --git a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountEntities.java b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountEntities.java index 96728ca..50bd28a 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountEntities.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountEntities.java @@ -22,6 +22,7 @@ public class PanelAmountEntities extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 3176339193502108176L; private JCheckBox chckbxFilter; private JButtonAccess btnKillAll; private JButtonAccess btnRefresh; diff --git a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountTileEnts.java b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountTileEnts.java index 8d23bcc..5059033 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountTileEnts.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelAmountTileEnts.java @@ -21,6 +21,7 @@ public class PanelAmountTileEnts extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 9211728946748086658L; private JButtonAccess btnRefresh; /** diff --git a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelDimensions.java b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelDimensions.java index a285018..6cffc67 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelDimensions.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelDimensions.java @@ -23,6 +23,7 @@ public class PanelDimensions extends JPanelMsgHandler implements IMessageHandler, ITabPanel { + private static final long serialVersionUID = -3506927196530957453L; private JButtonAccess btnPurgeAll; public PanelDimensions() { diff --git a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelPlayers.java b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelPlayers.java index fb97748..28ae671 100644 --- a/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelPlayers.java +++ b/src/main/java/mcp/mobius/opis/swing/panels/tracking/PanelPlayers.java @@ -21,6 +21,7 @@ public class PanelPlayers extends JPanelMsgHandler implements ITabPanel { + private static final long serialVersionUID = 7119395728044208903L; private JButtonAccess btnTeleport; private JButtonAccess btnPull; diff --git a/src/main/java/mcp/mobius/opis/swing/widgets/JButtonAccess.java b/src/main/java/mcp/mobius/opis/swing/widgets/JButtonAccess.java index 6904787..c3a289f 100644 --- a/src/main/java/mcp/mobius/opis/swing/widgets/JButtonAccess.java +++ b/src/main/java/mcp/mobius/opis/swing/widgets/JButtonAccess.java @@ -7,6 +7,7 @@ public class JButtonAccess extends JButton { + private static final long serialVersionUID = -2609076476128809204L; private AccessLevel al = AccessLevel.NONE; public JButtonAccess(AccessLevel level) { diff --git a/src/main/java/mcp/mobius/opis/swing/widgets/JPanelMsgHandler.java b/src/main/java/mcp/mobius/opis/swing/widgets/JPanelMsgHandler.java index 0a13d23..a078715 100644 --- a/src/main/java/mcp/mobius/opis/swing/widgets/JPanelMsgHandler.java +++ b/src/main/java/mcp/mobius/opis/swing/widgets/JPanelMsgHandler.java @@ -8,6 +8,7 @@ public abstract class JPanelMsgHandler extends JPanel implements IMessageHandler { + private static final long serialVersionUID = -2746994146968160784L; public JTableStats table; public Message cachedmsg; public PacketBase cachedrawdata; diff --git a/src/main/java/mcp/mobius/opis/swing/widgets/JTableButton.java b/src/main/java/mcp/mobius/opis/swing/widgets/JTableButton.java index 7ec1468..618ba14 100644 --- a/src/main/java/mcp/mobius/opis/swing/widgets/JTableButton.java +++ b/src/main/java/mcp/mobius/opis/swing/widgets/JTableButton.java @@ -31,6 +31,7 @@ public class JTableButton extends AbstractCellEditor implements TableCellRenderer, TableCellEditor, ActionListener, MouseListener { + private static final long serialVersionUID = -1051881661568367969L; private JTable table; private ActionListener action; private int mnemonic; diff --git a/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java b/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java index 2c19135..1145069 100644 --- a/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java +++ b/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java @@ -13,8 +13,11 @@ public class JTableStats extends JTable { + private static final long serialVersionUID = 9195559362001415233L; + public class OpisTableModel extends DefaultTableModel { + private static final long serialVersionUID = 993390082962150469L; String[] headers; Class[] columnTypes; boolean[] columnEditables; From 6435a9c433a590a544ba974d1ff4e12bdc03aef6 Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:10:27 +0100 Subject: [PATCH 3/5] Fix generics --- .../opis/commands/server/CommandChunkDump.java | 1 - .../mcp/mobius/opis/data/holders/DataType.java | 8 ++++---- .../opis/data/holders/basetypes/SerialNumeral.java | 2 +- .../opis/data/holders/basetypes/TicketData.java | 5 ++--- .../data/holders/clienttypes/DataRenderEvent.java | 8 ++++---- .../opis/data/holders/newtypes/CachedString.java | 6 +++--- .../opis/data/holders/newtypes/DataAmountRate.java | 6 +++--- .../newtypes/DataBlockTileEntityPerClass.java | 6 +++--- .../opis/data/holders/newtypes/DataByteRate.java | 6 +++--- .../opis/data/holders/newtypes/DataByteSize.java | 6 +++--- .../opis/data/holders/newtypes/DataChunk.java | 6 +++--- .../data/holders/newtypes/DataEntityPerClass.java | 6 +++--- .../opis/data/holders/newtypes/DataEvent.java | 8 ++++---- .../data/holders/newtypes/DataNetworkTick.java | 6 +++--- .../opis/data/holders/newtypes/DataTiming.java | 6 +++--- .../mobius/opis/data/managers/EntityManager.java | 11 +++++------ .../opis/data/managers/TileEntityManager.java | 2 +- .../mobius/opis/data/profilers/ProfilerEvent.java | 8 ++++---- .../data/profilers/ProfilerTileEntityUpdate.java | 2 +- .../mobius/opis/events/OpisClientTickHandler.java | 6 +++--- .../mcp/mobius/opis/gui/font/TrueTypeFont.java | 10 +++++----- .../java/mcp/mobius/opis/helpers/Teleport.java | 4 ++-- .../java/mcp/mobius/opis/network/PacketBase.java | 2 +- .../mcp/mobius/opis/network/PacketManager.java | 12 ++++++------ .../network/packets/client/PacketReqChunks.java | 2 +- .../mcp/mobius/opis/network/rcon/RConHandler.java | 2 +- .../opis/network/rcon/nexus/NexusMsgDecoder.java | 2 +- .../opis/network/rcon/server/RConMsgDecoder.java | 2 +- .../mcp/mobius/opis/swing/widgets/JTableStats.java | 14 +++++++------- 29 files changed, 81 insertions(+), 84 deletions(-) diff --git a/src/main/java/mcp/mobius/opis/commands/server/CommandChunkDump.java b/src/main/java/mcp/mobius/opis/commands/server/CommandChunkDump.java index 0154f11..13572af 100644 --- a/src/main/java/mcp/mobius/opis/commands/server/CommandChunkDump.java +++ b/src/main/java/mcp/mobius/opis/commands/server/CommandChunkDump.java @@ -31,7 +31,6 @@ public String getCommandUsage(ICommandSender icommandsender) { } @Override - @SuppressWarnings("unchecked") public void processCommand(ICommandSender icommandsender, String[] astring) { modOpis.log.log(Level.INFO, "== CHUNK DUMP =="); diff --git a/src/main/java/mcp/mobius/opis/data/holders/DataType.java b/src/main/java/mcp/mobius/opis/data/holders/DataType.java index 73e8b62..cbf6917 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/DataType.java +++ b/src/main/java/mcp/mobius/opis/data/holders/DataType.java @@ -90,18 +90,18 @@ public enum DataType { CONNECTIONPROPERTIES(ConnectionProperties.class), CHATMSG(ChatMsg.class); - private Class clazz; - private static HashBiMap bimap = HashBiMap.create(50); + private Class clazz; + private static HashBiMap> bimap = HashBiMap.create(50); static { for (DataType type : DataType.values()) bimap.put(type, type.clazz); } - private DataType(Class clazz) { + private DataType(Class clazz) { this.clazz = clazz; } - public static DataType getForClass(Class clazz) { + public static DataType getForClass(Class clazz) { DataType type = bimap.inverse().get(clazz); if (type == null) { modOpis.log.warn(String.format("Class %s was not registered with the DataType enum", clazz)); diff --git a/src/main/java/mcp/mobius/opis/data/holders/basetypes/SerialNumeral.java b/src/main/java/mcp/mobius/opis/data/holders/basetypes/SerialNumeral.java index f834673..76b84fd 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/basetypes/SerialNumeral.java +++ b/src/main/java/mcp/mobius/opis/data/holders/basetypes/SerialNumeral.java @@ -55,7 +55,7 @@ public void writeToSteam(DataOutputStream stream) throws IOException { } } - public static SerialNumeral readFromStream(DataInputStream stream) throws IOException { + public static SerialNumeral readFromStream(DataInputStream stream) throws IOException { Type datatype = Type.values()[stream.readByte()]; switch (datatype) { case DOUBLE: { diff --git a/src/main/java/mcp/mobius/opis/data/holders/basetypes/TicketData.java b/src/main/java/mcp/mobius/opis/data/holders/basetypes/TicketData.java index fcdac4c..e0b5769 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/basetypes/TicketData.java +++ b/src/main/java/mcp/mobius/opis/data/holders/basetypes/TicketData.java @@ -17,11 +17,10 @@ public final class TicketData implements ISerializable { public final Ticket ticket; public TicketData(Ticket ticket) { - ImmutableSet requestedChunks = ticket.getChunkList(); + ImmutableSet requestedChunks = ticket.getChunkList(); int maxChunkX = -999999, minChunkX = 9999999, maxChunkZ = -999999, minChunkZ = 9999999; - for (Object obj : requestedChunks) { - ChunkCoordIntPair chunk = (ChunkCoordIntPair) obj; + for (ChunkCoordIntPair chunk : requestedChunks) { maxChunkX = Math.max(maxChunkX, chunk.chunkXPos); minChunkX = Math.min(minChunkX, chunk.chunkXPos); maxChunkZ = Math.max(maxChunkZ, chunk.chunkZPos); diff --git a/src/main/java/mcp/mobius/opis/data/holders/clienttypes/DataRenderEvent.java b/src/main/java/mcp/mobius/opis/data/holders/clienttypes/DataRenderEvent.java index b7610d9..c57822b 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/clienttypes/DataRenderEvent.java +++ b/src/main/java/mcp/mobius/opis/data/holders/clienttypes/DataRenderEvent.java @@ -6,7 +6,7 @@ import mcp.mobius.opis.data.holders.newtypes.DataTiming; -public class DataRenderEvent implements Comparable { +public class DataRenderEvent implements Comparable { public String event; public String handler; @@ -15,7 +15,7 @@ public class DataRenderEvent implements Comparable { public long nCalls; public DataTiming update; - public DataRenderEvent fill(Cell cellData, String modName) { + public DataRenderEvent fill(Cell, String, DescriptiveStatistics> cellData, String modName) { /* * String handlerName = cell.getColumnKey().getSimpleName(); try { String[] splitHandler = * handlerName.split("_"); handlerName = splitHandler[2] + "." + splitHandler[3]; } catch (Exception e){} @@ -39,7 +39,7 @@ public DataRenderEvent fill(Cell cellData, } @Override - public int compareTo(Object o) { - return this.update.compareTo(((DataRenderEvent) o).update); + public int compareTo(DataRenderEvent o) { + return this.update.compareTo(o.update); } } diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/CachedString.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/CachedString.java index 5d811a7..9aaeb82 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/CachedString.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/CachedString.java @@ -8,7 +8,7 @@ import mcp.mobius.opis.data.managers.StringCache; import mcp.mobius.opis.helpers.Helpers; -public class CachedString implements Comparable, ISerializable { +public class CachedString implements Comparable, ISerializable { public String str; public int index; @@ -33,8 +33,8 @@ public CachedString(String str) { } @Override - public int compareTo(Object o) { - return ((CachedString) o).str.compareTo(this.str); // Reverse order ! Put higher values FIRST + public int compareTo(CachedString o) { + return o.str.compareTo(this.str); // Reverse order ! Put higher values FIRST } public String toString() { diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataAmountRate.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataAmountRate.java index 8db6ecd..2a30cab 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataAmountRate.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataAmountRate.java @@ -5,7 +5,7 @@ import mcp.mobius.opis.data.holders.ISerializable; -public class DataAmountRate implements Comparable, ISerializable { +public class DataAmountRate implements Comparable, ISerializable { public Long size; // Size is stored in byte public int interval; @@ -17,8 +17,8 @@ public DataAmountRate(long size, int interval) { } @Override - public int compareTo(Object o) { - return ((DataAmountRate) o).size.compareTo(this.size); // Reverse order ! Put higher values FIRST + public int compareTo(DataAmountRate o) { + return o.size.compareTo(this.size); // Reverse order ! Put higher values FIRST } public void reset() { diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataBlockTileEntityPerClass.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataBlockTileEntityPerClass.java index cf6cb1b..adc7e87 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataBlockTileEntityPerClass.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataBlockTileEntityPerClass.java @@ -6,7 +6,7 @@ import mcp.mobius.opis.data.holders.ISerializable; import mcp.mobius.opis.helpers.ModIdentification; -public class DataBlockTileEntityPerClass implements ISerializable, Comparable { +public class DataBlockTileEntityPerClass implements ISerializable, Comparable { public int id; public int meta; @@ -67,7 +67,7 @@ public static DataBlockTileEntityPerClass readFromStream(ByteArrayDataInput stre } @Override - public int compareTo(Object o) { - return this.update.compareTo(((DataBlockTileEntityPerClass) o).update); + public int compareTo(DataBlockTileEntityPerClass o) { + return this.update.compareTo(o.update); } } diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteRate.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteRate.java index 3e6d68f..401d1e8 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteRate.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteRate.java @@ -5,7 +5,7 @@ import mcp.mobius.opis.data.holders.ISerializable; -public class DataByteRate implements Comparable, ISerializable { +public class DataByteRate implements Comparable, ISerializable { public Long size; // Size is stored in byte public int interval; @@ -17,8 +17,8 @@ public DataByteRate(long size, int interval) { } @Override - public int compareTo(Object o) { - return ((DataByteRate) o).size.compareTo(this.size); // Reverse order ! Put higher values FIRST + public int compareTo(DataByteRate o) { + return o.size.compareTo(this.size); // Reverse order ! Put higher values FIRST } public void reset() { diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteSize.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteSize.java index 52e95ed..bacedbb 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteSize.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataByteSize.java @@ -5,7 +5,7 @@ import mcp.mobius.opis.data.holders.ISerializable; -public class DataByteSize implements Comparable, ISerializable { +public class DataByteSize implements Comparable, ISerializable { public Long size; // Size is stored in byte @@ -18,8 +18,8 @@ public DataByteSize(long size) { } @Override - public int compareTo(Object o) { - return ((DataByteSize) o).size.compareTo(this.size); // Reverse order ! Put higher values FIRST + public int compareTo(DataByteSize o) { + return o.size.compareTo(this.size); // Reverse order ! Put higher values FIRST } public String toString() { diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataChunk.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataChunk.java index 58716d3..4497147 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataChunk.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataChunk.java @@ -10,7 +10,7 @@ import mcp.mobius.opis.data.managers.EntityManager; import mcp.mobius.opis.data.managers.TileEntityManager; -public class DataChunk implements ISerializable, Comparable { +public class DataChunk implements ISerializable, Comparable { int nentities; int ntileents; @@ -51,7 +51,7 @@ public static DataChunk readFromStream(ByteArrayDataInput stream) { } @Override - public int compareTo(Object o) { - return this.update.compareTo(((DataEntity) o).update); + public int compareTo(DataChunk o) { + return this.update.compareTo(o.update); } } diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEntityPerClass.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEntityPerClass.java index e04a803..8d34c82 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEntityPerClass.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEntityPerClass.java @@ -5,7 +5,7 @@ import mcp.mobius.opis.data.holders.ISerializable; -public class DataEntityPerClass implements Comparable, ISerializable { +public class DataEntityPerClass implements Comparable, ISerializable { public int nents; public CachedString name; @@ -42,7 +42,7 @@ public static DataEntityPerClass readFromStream(ByteArrayDataInput stream) { } @Override - public int compareTo(Object o) { - return this.update.compareTo(((DataEntityPerClass) o).update); + public int compareTo(DataEntityPerClass o) { + return this.update.compareTo(o.update); } } diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEvent.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEvent.java index 2f7751c..4b07bc0 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEvent.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataEvent.java @@ -8,7 +8,7 @@ import mcp.mobius.opis.data.holders.ISerializable; -public class DataEvent implements ISerializable, Comparable { +public class DataEvent implements ISerializable, Comparable { public CachedString event; public CachedString handler; @@ -17,7 +17,7 @@ public class DataEvent implements ISerializable, Comparable { public long nCalls; public DataTiming update; - public DataEvent fill(Cell cellData, String modName) { + public DataEvent fill(Cell, String, DescriptiveStatistics> cellData, String modName) { /* * String handlerName = cell.getColumnKey().getSimpleName(); try { String[] splitHandler = * handlerName.split("_"); handlerName = splitHandler[2] + "." + splitHandler[3]; } catch (Exception e){} @@ -62,7 +62,7 @@ public static DataEvent readFromStream(ByteArrayDataInput stream) { } @Override - public int compareTo(Object o) { - return this.update.compareTo(((DataEvent) o).update); + public int compareTo(DataEvent o) { + return this.update.compareTo(o.update); } } diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataNetworkTick.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataNetworkTick.java index 16a24d8..718c6b8 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataNetworkTick.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataNetworkTick.java @@ -9,7 +9,7 @@ import mcp.mobius.opis.data.holders.ISerializable; import mcp.mobius.opis.data.profilers.ProfilerNetworkTick; -public class DataNetworkTick implements ISerializable, Comparable { +public class DataNetworkTick implements ISerializable, Comparable { public DataTiming update; @@ -33,7 +33,7 @@ public static DataNetworkTick readFromStream(ByteArrayDataInput stream) { } @Override - public int compareTo(Object o) { - return this.update.compareTo(((DataNetworkTick) o).update); + public int compareTo(DataNetworkTick o) { + return this.update.compareTo(o.update); } } diff --git a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataTiming.java b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataTiming.java index c25f3c0..1976c3a 100644 --- a/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataTiming.java +++ b/src/main/java/mcp/mobius/opis/data/holders/newtypes/DataTiming.java @@ -5,7 +5,7 @@ import mcp.mobius.opis.data.holders.ISerializable; -public class DataTiming implements Comparable, ISerializable { +public class DataTiming implements Comparable, ISerializable { public Double timing; @@ -18,8 +18,8 @@ public DataTiming(double timing) { } @Override - public int compareTo(Object o) { - return ((DataTiming) o).timing.compareTo(this.timing); // Reverse order ! Put higher values FIRST + public int compareTo(DataTiming o) { + return o.timing.compareTo(this.timing); // Reverse order ! Put higher values FIRST } public DataTimingMillisecond asMillisecond() { diff --git a/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java b/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java index b51c784..5667b18 100644 --- a/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java +++ b/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java @@ -152,7 +152,7 @@ public ArrayList getCumulativeEntities(boolean filtered) { world.loadedEntityList = newList; } - Map count = ((MonitoredEntityList) world.loadedEntityList).getCount(); + Map count = ((MonitoredEntityList) world.loadedEntityList).getCount(); for (String key : count.keySet()) if (count.get(key) > 0) cumData.add(new AmountHolder(key, count.get(key), "Plop")); } @@ -275,13 +275,12 @@ public int killAll(String entName) { public ArrayList getAllPlayers() { // List players = MinecraftServer.getServerConfigurationManager(MinecraftServer.getServer()).playerEntityList; - List players = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + List players = MinecraftServer.getServer().getConfigurationManager().playerEntityList; ArrayList outList = new ArrayList(); - for (Object o : players) { + for (EntityPlayerMP p : players) { // outList.add(new DataEntity().fill((EntityPlayer) p)); - EntityPlayer p = (EntityPlayer) o; outList.add( new PlayerStatus( p.getGameProfile().getName(), @@ -303,13 +302,13 @@ public int getAmountEntities() { return amountEntities; } - public int killAllPerClass(int dim, Class clazz) { + public int killAllPerClass(int dim, Class clazz) { WorldServer world = DimensionManager.getWorld(dim); if (world == null) return -1; int killedEnts = 0; - ArrayList copyList = new ArrayList(world.loadedEntityList); + ArrayList copyList = new ArrayList<>(world.loadedEntityList); for (Entity entity : (ArrayList) copyList) { if (clazz.isInstance(entity)) { diff --git a/src/main/java/mcp/mobius/opis/data/managers/TileEntityManager.java b/src/main/java/mcp/mobius/opis/data/managers/TileEntityManager.java index 607344b..e4f5e2e 100644 --- a/src/main/java/mcp/mobius/opis/data/managers/TileEntityManager.java +++ b/src/main/java/mcp/mobius/opis/data/managers/TileEntityManager.java @@ -199,7 +199,7 @@ public ArrayList getCumulativeAmountTileEntities() { world.loadedTileEntityList = newList; } - Table count = ((MonitoredTileList) world.loadedTileEntityList).getCount(); + Table count = ((MonitoredTileList) world.loadedTileEntityList).getCount(); Table reducedCount = HashBasedTable.create(); for (Cell c : count.cellSet()) { diff --git a/src/main/java/mcp/mobius/opis/data/profilers/ProfilerEvent.java b/src/main/java/mcp/mobius/opis/data/profilers/ProfilerEvent.java index 41d6dae..d8908c4 100644 --- a/src/main/java/mcp/mobius/opis/data/profilers/ProfilerEvent.java +++ b/src/main/java/mcp/mobius/opis/data/profilers/ProfilerEvent.java @@ -10,11 +10,11 @@ public class ProfilerEvent extends ProfilerAbstract { private IClock clock = Clock.getNewClock(); - public HashBasedTable data = HashBasedTable.create(); - public HashBasedTable dataMod = HashBasedTable.create(); + public HashBasedTable, String, DescriptiveStatistics> data = HashBasedTable.create(); + public HashBasedTable, String, String> dataMod = HashBasedTable.create(); - public HashBasedTable dataTick = HashBasedTable.create(); - public HashBasedTable dataModTick = HashBasedTable.create(); + public HashBasedTable, String, DescriptiveStatistics> dataTick = HashBasedTable.create(); + public HashBasedTable, String, String> dataModTick = HashBasedTable.create(); @Override public void reset() { diff --git a/src/main/java/mcp/mobius/opis/data/profilers/ProfilerTileEntityUpdate.java b/src/main/java/mcp/mobius/opis/data/profilers/ProfilerTileEntityUpdate.java index b0c4029..129d339 100644 --- a/src/main/java/mcp/mobius/opis/data/profilers/ProfilerTileEntityUpdate.java +++ b/src/main/java/mcp/mobius/opis/data/profilers/ProfilerTileEntityUpdate.java @@ -13,7 +13,7 @@ public class ProfilerTileEntityUpdate extends ProfilerAbstract { private IClock clock = Clock.getNewClock(); public HashMap data = new HashMap(); - public HashMap refs = new HashMap(); + public HashMap> refs = new HashMap>(); @Override public void reset() { diff --git a/src/main/java/mcp/mobius/opis/events/OpisClientTickHandler.java b/src/main/java/mcp/mobius/opis/events/OpisClientTickHandler.java index f4d9825..c56e5c2 100644 --- a/src/main/java/mcp/mobius/opis/events/OpisClientTickHandler.java +++ b/src/main/java/mcp/mobius/opis/events/OpisClientTickHandler.java @@ -165,11 +165,11 @@ private void updateTabs() { // ==================================================================================== ArrayList timingEvents = new ArrayList(); - HashBasedTable eventData = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE + HashBasedTable, String, DescriptiveStatistics> eventData = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE .getProfiler()).data; - HashBasedTable eventMod = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE + HashBasedTable, String, String> eventMod = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE .getProfiler()).dataMod; - for (Cell cell : eventData.cellSet()) { + for (Cell, String, DescriptiveStatistics> cell : eventData.cellSet()) { timingEvents.add(new DataRenderEvent().fill(cell, eventMod.get(cell.getRowKey(), cell.getColumnKey()))); } ((PanelEventClient) (TabPanelRegistrar.INSTANCE.getTab(SelectedTab.CLIENTEVENTS))).setTable(timingEvents); diff --git a/src/main/java/mcp/mobius/opis/gui/font/TrueTypeFont.java b/src/main/java/mcp/mobius/opis/gui/font/TrueTypeFont.java index 5873f37..b919692 100644 --- a/src/main/java/mcp/mobius/opis/gui/font/TrueTypeFont.java +++ b/src/main/java/mcp/mobius/opis/gui/font/TrueTypeFont.java @@ -200,7 +200,7 @@ private void createSet(char[] customCharsArray) { if (i < 256) { // standard characters charArray[i] = newIntObject; } else { // custom characters - customChars.put(new Character(ch), newIntObject); + customChars.put(ch, newIntObject); } fontImage = null; @@ -262,7 +262,7 @@ public int getWidth(String whatchars) { if (currentChar < 256) { intObject = charArray[currentChar]; } else { - intObject = (IntObject) customChars.get(new Character((char) currentChar)); + intObject = (IntObject) customChars.get((char) currentChar); } if (intObject != null) { @@ -331,7 +331,7 @@ public void drawString(float x, float y, String whatchars, int startIndex, int e if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { - intObject = (IntObject) customChars.get(new Character((char) charCurrent)); + intObject = (IntObject) customChars.get((char) charCurrent); } totalwidth += intObject.width - correctL; } @@ -355,7 +355,7 @@ public void drawString(float x, float y, String whatchars, int startIndex, int e if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { - intObject = (IntObject) customChars.get(new Character((char) charCurrent)); + intObject = (IntObject) customChars.get((char) charCurrent); } if (intObject != null) { @@ -370,7 +370,7 @@ public void drawString(float x, float y, String whatchars, int startIndex, int e if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { - intObject = (IntObject) customChars.get(new Character((char) charCurrent)); + intObject = (IntObject) customChars.get((char) charCurrent); } totalwidth += intObject.width - correctL; } diff --git a/src/main/java/mcp/mobius/opis/helpers/Teleport.java b/src/main/java/mcp/mobius/opis/helpers/Teleport.java index 2887ab7..848eaed 100644 --- a/src/main/java/mcp/mobius/opis/helpers/Teleport.java +++ b/src/main/java/mcp/mobius/opis/helpers/Teleport.java @@ -65,10 +65,10 @@ public boolean transferPlayerToDimension(ServerConfigurationManager manager, Ent manager.updateTimeAndWeatherForPlayer(player, targetWorld); manager.syncPlayerInventory(player); - Iterator iterator = player.getActivePotionEffects().iterator(); + Iterator iterator = player.getActivePotionEffects().iterator(); while (iterator.hasNext()) { - PotionEffect potioneffect = (PotionEffect) iterator.next(); + PotionEffect potioneffect = iterator.next(); // player.playerNetServerHandler.sendPacket(new Packet41EntityEffect(player.entityId, potioneffect)); player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect)); } diff --git a/src/main/java/mcp/mobius/opis/network/PacketBase.java b/src/main/java/mcp/mobius/opis/network/PacketBase.java index 4ff8ba5..0ca0733 100644 --- a/src/main/java/mcp/mobius/opis/network/PacketBase.java +++ b/src/main/java/mcp/mobius/opis/network/PacketBase.java @@ -25,7 +25,7 @@ public abstract class PacketBase { public byte header; public Message msg; public String clazzStr; - public Class clazz; + public Class clazz; public ArrayList array = null; public ISerializable value = null; diff --git a/src/main/java/mcp/mobius/opis/network/PacketManager.java b/src/main/java/mcp/mobius/opis/network/PacketManager.java index 5f8d1ba..67a69ac 100644 --- a/src/main/java/mcp/mobius/opis/network/PacketManager.java +++ b/src/main/java/mcp/mobius/opis/network/PacketManager.java @@ -292,20 +292,20 @@ public static void sendFullUpdate(EntityPlayerMP player) { DataBlockTick totalWorldTick = new DataBlockTick().fill(); ArrayList timingEvents = new ArrayList(); - HashBasedTable eventData = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE + HashBasedTable, String, DescriptiveStatistics> eventData = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE .getProfiler()).data; - HashBasedTable eventMod = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE + HashBasedTable, String, String> eventMod = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE .getProfiler()).dataMod; - for (Cell cell : eventData.cellSet()) { + for (Cell, String, DescriptiveStatistics> cell : eventData.cellSet()) { timingEvents.add(new DataEvent().fill(cell, eventMod.get(cell.getRowKey(), cell.getColumnKey()))); } ArrayList timingTicks = new ArrayList(); - HashBasedTable eventTickData = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE + HashBasedTable, String, DescriptiveStatistics> eventTickData = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE .getProfiler()).dataTick; - HashBasedTable eventTickMod = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE + HashBasedTable, String, String> eventTickMod = ((ProfilerEvent) ProfilerSection.EVENT_INVOKE .getProfiler()).dataModTick; - for (Cell cell : eventTickData.cellSet()) { + for (Cell, String, DescriptiveStatistics> cell : eventTickData.cellSet()) { timingTicks.add(new DataEvent().fill(cell, eventTickMod.get(cell.getRowKey(), cell.getColumnKey()))); } diff --git a/src/main/java/mcp/mobius/opis/network/packets/client/PacketReqChunks.java b/src/main/java/mcp/mobius/opis/network/packets/client/PacketReqChunks.java index aff8dff..1658662 100644 --- a/src/main/java/mcp/mobius/opis/network/packets/client/PacketReqChunks.java +++ b/src/main/java/mcp/mobius/opis/network/packets/client/PacketReqChunks.java @@ -43,7 +43,7 @@ public void decode(ByteArrayDataInput input) { @Override public void actionServer(World world, EntityPlayerMP player) { if (PlayerTracker.INSTANCE.getPlayerAccessLevel(player).ordinal() > AccessLevel.PRIVILEGED.ordinal()) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); if (world != null) { for (CoordinatesChunk chunk : chunks) diff --git a/src/main/java/mcp/mobius/opis/network/rcon/RConHandler.java b/src/main/java/mcp/mobius/opis/network/rcon/RConHandler.java index 89b8ffc..413b1b9 100644 --- a/src/main/java/mcp/mobius/opis/network/rcon/RConHandler.java +++ b/src/main/java/mcp/mobius/opis/network/rcon/RConHandler.java @@ -28,7 +28,7 @@ public class RConHandler { - public static BiMap packetTypes = HashBiMap.create(); + public static BiMap> packetTypes = HashBiMap.create(); public static BiMap fakePlayersRcon = HashBiMap.create(); public static BiMap fakePlayersNexus = HashBiMap.create(); diff --git a/src/main/java/mcp/mobius/opis/network/rcon/nexus/NexusMsgDecoder.java b/src/main/java/mcp/mobius/opis/network/rcon/nexus/NexusMsgDecoder.java index df2b528..3716b6c 100644 --- a/src/main/java/mcp/mobius/opis/network/rcon/nexus/NexusMsgDecoder.java +++ b/src/main/java/mcp/mobius/opis/network/rcon/nexus/NexusMsgDecoder.java @@ -27,7 +27,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t // Here we should get a list of potential packets and decode for the corresponding byte - PacketBase packet = (PacketBase) RConHandler.packetTypes.get(packetType).newInstance(); + PacketBase packet = RConHandler.packetTypes.get(packetType).getConstructor().newInstance(); packet.decode(ByteStreams.newDataInput(in.readBytes(packetSize).array())); out.add(packet); } diff --git a/src/main/java/mcp/mobius/opis/network/rcon/server/RConMsgDecoder.java b/src/main/java/mcp/mobius/opis/network/rcon/server/RConMsgDecoder.java index e273605..0902ee0 100644 --- a/src/main/java/mcp/mobius/opis/network/rcon/server/RConMsgDecoder.java +++ b/src/main/java/mcp/mobius/opis/network/rcon/server/RConMsgDecoder.java @@ -27,7 +27,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t // Here we should get a list of potential packets and decode for the corresponding byte - PacketBase packet = (PacketBase) RConHandler.packetTypes.get(packetType).newInstance(); + PacketBase packet = RConHandler.packetTypes.get(packetType).getConstructor().newInstance(); packet.decode(ByteStreams.newDataInput(in.readBytes(packetSize).array())); out.add(packet); } diff --git a/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java b/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java index 1145069..b697da4 100644 --- a/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java +++ b/src/main/java/mcp/mobius/opis/swing/widgets/JTableStats.java @@ -19,10 +19,10 @@ public class OpisTableModel extends DefaultTableModel { private static final long serialVersionUID = 993390082962150469L; String[] headers; - Class[] columnTypes; + Class[] columnTypes; boolean[] columnEditables; - public OpisTableModel(String[] headers, Class[] columnTypes, boolean[] columnEditables) { + public OpisTableModel(String[] headers, Class[] columnTypes, boolean[] columnEditables) { super(new Object[][] {}, headers); this.headers = headers; this.columnTypes = columnTypes; @@ -30,7 +30,7 @@ public OpisTableModel(String[] headers, Class[] columnTypes, boolean[] columnEdi } @Override - public Class getColumnClass(int columnIndex) { + public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } @@ -43,7 +43,7 @@ public boolean isCellEditable(int row, int column) { protected ArrayList statistics; protected int[] alignList; - public JTableStats(String[] headers, Class[] columnTypes) { + public JTableStats(String[] headers, Class[] columnTypes) { this( headers, columnTypes, @@ -53,7 +53,7 @@ public JTableStats(String[] headers, Class[] columnTypes) { new boolean[] { false, false, false, false, false, false, false, false, false, false }); } - public JTableStats(String[] headers, Class[] columnTypes, boolean[] editable) { + public JTableStats(String[] headers, Class[] columnTypes, boolean[] editable) { this( headers, columnTypes, @@ -63,7 +63,7 @@ public JTableStats(String[] headers, Class[] columnTypes, boolean[] editable) { editable); } - public JTableStats(String[] headers, Class[] columnTypes, int[] align) { + public JTableStats(String[] headers, Class[] columnTypes, int[] align) { this( headers, columnTypes, @@ -71,7 +71,7 @@ public JTableStats(String[] headers, Class[] columnTypes, int[] align) { new boolean[] { false, false, false, false, false, false, false, false, false, false }); } - public JTableStats(String[] headers, Class[] columnTypes, int[] align, boolean[] editable) { + public JTableStats(String[] headers, Class[] columnTypes, int[] align, boolean[] editable) { super(); this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); From 0042805597215ca9d33aff0383c1a240189474bd Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:11:51 +0100 Subject: [PATCH 4/5] Fix tags --- gradle.properties | 14 +++++++++----- .../mcp/mobius/mobiuscore/asm/CoreContainer.java | 3 ++- src/main/java/mcp/mobius/opis/modOpis.java | 7 ++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6640275..cf130f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,15 +36,19 @@ enableModernJavaSyntax = true # Turns most publicly visible List, Map, etc. into proper List, Map types enableGenericInjection = true +# Generate a class with String fields for the mod id, name, version and group name named with the fields below +generateGradleTokenClass = mcp.mobius.Tags +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = VERSION +gradleTokenGroupName = +# [DEPRECATED] +# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java # public static final String VERSION = "GRADLETOKEN_VERSION"; # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]) # Leave these properties empty to skip individual token replacements -replaceGradleTokenInFile = modOpis.java,CoreContainer.java -gradleTokenModId = GRADLETOKEN_MODID -gradleTokenModName = GRADLETOKEN_MODNAME -gradleTokenVersion = GRADLETOKEN_VERSION -gradleTokenGroupName = GRADLETOKEN_GROUPNAME +replaceGradleTokenInFile = # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # leave this property empty. diff --git a/src/main/java/mcp/mobius/mobiuscore/asm/CoreContainer.java b/src/main/java/mcp/mobius/mobiuscore/asm/CoreContainer.java index e622bf2..5511598 100644 --- a/src/main/java/mcp/mobius/mobiuscore/asm/CoreContainer.java +++ b/src/main/java/mcp/mobius/mobiuscore/asm/CoreContainer.java @@ -7,6 +7,7 @@ import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; import cpw.mods.fml.common.ModMetadata; +import mcp.mobius.Tags; public class CoreContainer extends DummyModContainer { @@ -16,7 +17,7 @@ public CoreContainer() { ModMetadata md = getMetadata(); md.modId = "MobiusCore"; md.name = "MobiusCore"; - md.version = "GRADLETOKEN_VERSION"; + md.version = Tags.VERSION; md.credits = "ProfMobius"; md.authorList = Arrays.asList("ProfMobius"); md.description = ""; diff --git a/src/main/java/mcp/mobius/opis/modOpis.java b/src/main/java/mcp/mobius/opis/modOpis.java index 2b55e8b..4ad6fed 100644 --- a/src/main/java/mcp/mobius/opis/modOpis.java +++ b/src/main/java/mcp/mobius/opis/modOpis.java @@ -19,6 +19,7 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.event.FMLServerStoppedEvent; import cpw.mods.fml.common.registry.GameRegistry; +import mcp.mobius.Tags; import mcp.mobius.mobiuscore.profiler.ProfilerSection; import mcp.mobius.opis.commands.client.CommandOpis; import mcp.mobius.opis.commands.server.CommandAddPrivileged; @@ -64,9 +65,9 @@ import mcp.mobius.opis.tools.TileLag; @Mod( - modid = "GRADLETOKEN_MODID", - name = "GRADLETOKEN_MODNAME", - version = "GRADLETOKEN_VERSION", + modid = "Opis", + name = "Opis", + version = Tags.VERSION, acceptableRemoteVersions = "*") public class modOpis { From 718a9149ab4fb44e4090ad49fc07c83012387d5e Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:12:14 +0100 Subject: [PATCH 5/5] Apply spotless --- .../java/mcp/mobius/opis/data/managers/EntityManager.java | 1 - src/main/java/mcp/mobius/opis/modOpis.java | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java b/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java index 5667b18..94e4606 100644 --- a/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java +++ b/src/main/java/mcp/mobius/opis/data/managers/EntityManager.java @@ -8,7 +8,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; diff --git a/src/main/java/mcp/mobius/opis/modOpis.java b/src/main/java/mcp/mobius/opis/modOpis.java index 4ad6fed..a09a60d 100644 --- a/src/main/java/mcp/mobius/opis/modOpis.java +++ b/src/main/java/mcp/mobius/opis/modOpis.java @@ -64,11 +64,7 @@ import mcp.mobius.opis.tools.TileDebug; import mcp.mobius.opis.tools.TileLag; -@Mod( - modid = "Opis", - name = "Opis", - version = Tags.VERSION, - acceptableRemoteVersions = "*") +@Mod(modid = "Opis", name = "Opis", version = Tags.VERSION, acceptableRemoteVersions = "*") public class modOpis { @Instance("Opis")