RConConsoleSource .java

net.minecraft.network.rcon.RConConsoleSource (class): members: buffer, getCommandSenderEntity, getPositionVector, getEntityWorld, setCommandStat, instance.

net.minecraft.network.rconclass100 linescommon2.6 KB

Implements

API Surface (10)

String getName()
IChatComponent getDisplayName()
void addChatMessage(IChatComponent component)
boolean canCommandSenderUseCommand(int permLevel, String commandName)
BlockPos getPosition()
Vec3 getPositionVector()
World getEntityWorld()
Entity getCommandSenderEntity()
boolean sendCommandFeedback()
void setCommandStat(CommandResultStats.Type type, int amount)

Fields & Constants (2)

instance
buffer

String literals (1)

"Rcon"

Full Source

RConConsoleSource.java100 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.rcon;
2
3
import net.minecraft.command.CommandResultStats;
4
import net.minecraft.command.ICommandSender;
5
import net.minecraft.entity.Entity;
6
import net.minecraft.server.MinecraftServer;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.util.ChatComponentText;
9
import net.minecraft.util.IChatComponent;
10
import net.minecraft.util.Vec3;
11
import net.minecraft.world.World;
12
13
public class RConConsoleSource implements ICommandSender
14
{
15
    /** Single instance of RConConsoleSource */
16
    private static final RConConsoleSource instance = new RConConsoleSource();
17
18
    /** RCon string buffer for log. */
19
    private StringBuffer buffer = new StringBuffer();
20
21
    /**
22
     * Get the name of this object. For players this returns their username
23
     */
24
    public String getName()
25
    {
26
        return "Rcon";
27
    }
28
29
    /**
30
     * Get the formatted ChatComponent that will be used for the sender's username in chat
31
     */
32
    public IChatComponent getDisplayName()
33
    {
34
        return new ChatComponentText(this.getName());
35
    }
36
37
    /**
38
     * Send a chat message to the CommandSender
39
     */
40
    public void addChatMessage(IChatComponent component)
41
    {
42
        this.buffer.append(component.getUnformattedText());
43
    }
44
45
    /**
46
     * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
47
     */
48
    public boolean canCommandSenderUseCommand(int permLevel, String commandName)
49
    {
50
        return true;
51
    }
52
53
    /**
54
     * Get the position in the world. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return
55
     * the coordinates 0, 0, 0
56
     */
57
    public BlockPos getPosition()
58
    {
59
        return new BlockPos(0, 0, 0);
60
    }
61
62
    /**
63
     * Get the position vector. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return 0.0D,
64
     * 0.0D, 0.0D
65
     */
66
    public Vec3 getPositionVector()
67
    {
68
        return new Vec3(0.0D, 0.0D, 0.0D);
69
    }
70
71
    /**
72
     * Get the world, if available. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return
73
     * the overworld
74
     */
75
    public World getEntityWorld()
76
    {
77
        return MinecraftServer.getServer().getEntityWorld();
78
    }
79
80
    /**
81
     * Returns the entity associated with the command sender. MAY BE NULL!
82
     */
83
    public Entity getCommandSenderEntity()
84
    {
85
        return null;
86
    }
87
88
    /**
89
     * Returns true if the command sender should be sent feedback about executed commands
90
     */
91
    public boolean sendCommandFeedback()
92
    {
93
        return true;
94
    }
95
96
    public void setCommandStat(CommandResultStats.Type type, int amount)
97
    {
98
    }
99
}
100

Deobfuscated MCP 1.8.9 source of RConConsoleSource from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/rcon/RConConsoleSource.java), stored verbatim.