aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/core/handler/ResourceHandler.java
blob: e8f81f4d02713574d27bfe75a31fc895c2f70405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package miscutil.core.handler;

import org.apache.commons.lang3.Validate;

public class ResourceHandler
{
    private final String resourceDomain;
    private final String resourcePath;
    private static final String __OBFID = "CL_00001082";

    public ResourceHandler(String p_i1292_1_, String p_i1292_2_)
    {
        Validate.notNull(p_i1292_2_);

        if (p_i1292_1_ != null && p_i1292_1_.length() != 0)
        {
            this.resourceDomain = p_i1292_1_;
        }
        else
        {
            this.resourceDomain = "minecraft";
        }

        this.resourcePath = p_i1292_2_;
    }

    public ResourceHandler(String p_i1293_1_)
    {
        String s1 = "miscUtils";
        String s2 = p_i1293_1_;
        int i = p_i1293_1_.indexOf(58);

        if (i >= 0)
        {
            s2 = p_i1293_1_.substring(i + 1, p_i1293_1_.length());

            if (i > 1)
            {
                s1 = p_i1293_1_.substring(0, i);
            }
        }

        this.resourceDomain = s1.toLowerCase();
        this.resourcePath = s2;
    }

    public String getResourcePath()
    {
        return this.resourcePath;
    }

    public String getResourceDomain()
    {
        return this.resourceDomain;
    }

    public String toString()
    {
        return this.resourceDomain + ":" + this.resourcePath;
    }

    public boolean equals(Object p_equals_1_)
    {
        if (this == p_equals_1_)
        {
            return true;
        }
        else if (!(p_equals_1_ instanceof ResourceHandler))
        {
            return false;
        }
        else
        {
            ResourceHandler resourcelocation = (ResourceHandler)p_equals_1_;
            return this.resourceDomain.equals(resourcelocation.resourceDomain) && this.resourcePath.equals(resourcelocation.resourcePath);
        }
    }

    public int hashCode()
    {
        return 31 * this.resourceDomain.hashCode() + this.resourcePath.hashCode();
    }
}