-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
301 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
group 'com.fox2code' | ||
version project['foxloader.version'] |
53 changes: 53 additions & 0 deletions
53
api/src/main/java/net/minecraft/server/command/Command.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package net.minecraft.server.command; | ||
|
||
// https://git.derekunavailable.direct/Dereku/ReIndevPatches | ||
public abstract class Command { | ||
|
||
private final String commandLabel; | ||
private final String[] aliases; | ||
private IssuerRole canUseThisCommand = IssuerRole.BOTH; | ||
|
||
public Command(final String name) { | ||
this.commandLabel = name; | ||
this.aliases = new String[0]; | ||
} | ||
|
||
public Command(final String name, final String[] aliases) { | ||
this.commandLabel = name; | ||
this.aliases = aliases; | ||
} | ||
|
||
public abstract void execute(String commandLabel, String[] args, CommandSender commandSender); | ||
|
||
public String getCommandLabel() { | ||
return commandLabel; | ||
} | ||
|
||
public String[] getAliases() { | ||
return aliases; | ||
} | ||
|
||
public boolean onlyForOperators() { | ||
return true; | ||
} | ||
|
||
public boolean hideCommandArgs() { | ||
return false; | ||
} | ||
|
||
public IssuerRole getRoleToUseThisCommand() { | ||
return canUseThisCommand; | ||
} | ||
|
||
protected final void setIssuerRole(IssuerRole role) { | ||
this.canUseThisCommand = role; | ||
} | ||
|
||
protected final int parseInt(String input, int value) { | ||
if (input.matches("-?[0-9]*")) { | ||
return Integer.parseInt(input); | ||
} else { | ||
return value; | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
api/src/main/java/net/minecraft/server/command/CommandRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package net.minecraft.server.command; | ||
|
||
import net.minecraft.server.plugin.JavaPlugin; | ||
|
||
public class CommandRegistry { | ||
private static final CommandRegistry INSTANCE = new CommandRegistry(); | ||
|
||
private CommandRegistry() {} | ||
|
||
public static CommandRegistry getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
public boolean registerCommand(JavaPlugin owner, Command command, boolean override) { | ||
return true; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
api/src/main/java/net/minecraft/server/command/CommandSender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.minecraft.server.command; | ||
|
||
|
||
// https://git.derekunavailable.direct/Dereku/ReIndevPatches | ||
public class CommandSender { | ||
public boolean isPlayer() { | ||
return false; | ||
} | ||
|
||
public void sendMessage(String message) {} | ||
|
||
/* public EntityPlayerMP getPlayer(); */ | ||
} |
6 changes: 6 additions & 0 deletions
6
api/src/main/java/net/minecraft/server/command/IssuerRole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package net.minecraft.server.command; | ||
|
||
// https://git.derekunavailable.direct/Dereku/ReIndevPatches | ||
public enum IssuerRole { | ||
CONSOLE, PLAYER, BOTH | ||
} |
16 changes: 16 additions & 0 deletions
16
api/src/main/java/net/minecraft/server/plugin/JavaPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package net.minecraft.server.plugin; | ||
|
||
import net.minecraft.server.command.Command; | ||
import net.minecraft.server.command.CommandRegistry; | ||
|
||
// https://git.derekunavailable.direct/Dereku/ReIndevPatches | ||
public class JavaPlugin { | ||
@Deprecated | ||
public String getName() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
public boolean registerCommand(Command command, boolean override) { | ||
return CommandRegistry.getInstance().registerCommand(this, command, override); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...src/main/java/com/fox2code/foxloader/loader/transformer/ConsoleLogManagerTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.fox2code.foxloader.loader.transformer; | ||
|
||
import org.objectweb.asm.tree.*; | ||
|
||
public class ConsoleLogManagerTransformer implements PreClassTransformer { | ||
@Override | ||
public void transform(ClassNode classNode, String className) { | ||
if (!"net.minecraft.src.server.ConsoleLogManager".equals(className)) return; | ||
MethodNode methodNode = TransformerUtils.findMethod(classNode, "init"); | ||
if (methodNode == null) return; | ||
for (AbstractInsnNode abstractInsnNode : methodNode.instructions) { | ||
if (abstractInsnNode.getOpcode() == RETURN) { | ||
InsnList insnList = new InsnList(); | ||
insnList.add(new FieldInsnNode(GETSTATIC, | ||
"net/minecraft/src/server/ConsoleLogManager", | ||
"logger", "Ljava/util/logging/Logger;")); | ||
insnList.add(new MethodInsnNode(INVOKESTATIC, | ||
"com/fox2code/foxloader/launcher/FoxLauncher", | ||
"installLoggerHelperOn", "(Ljava/util/logging/Logger;)V", false)); | ||
methodNode.instructions.insertBefore(abstractInsnNode, insnList); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.