();
28 | public SpoutEntitySkin() {
29 | }
30 |
31 | public void setSkin(EntitySkinType type, String url) {
32 | textures.put(type, url);
33 | }
34 |
35 | public String getSkin(EntitySkinType type) {
36 | return textures.get(type);
37 | }
38 |
39 | public void reset() {
40 | textures.clear();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spout/precache/PrecacheTuple.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spout.precache;
21 |
22 | public class PrecacheTuple {
23 | private String plugin;
24 | private String version;
25 | private long crc;
26 |
27 | /**
28 | * A tuple for zip -> crc
29 | * @param plugin - Name of the plugin
30 | * @param version - plugin version
31 | * @param crc - crc of the precache file
32 | */
33 | public PrecacheTuple(String plugin, String version, long crc) {
34 | this.plugin = plugin;
35 | this.version = version;
36 | this.crc = crc;
37 | }
38 |
39 | public String getPlugin() {
40 | return plugin;
41 | }
42 |
43 | public String getVersion() {
44 | return version;
45 | }
46 |
47 | public long getCrc() {
48 | return crc;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spout/util/DeadlockMonitor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spout.util;
21 |
22 | import java.lang.management.ManagementFactory;
23 | import java.lang.management.ThreadInfo;
24 | import java.lang.management.ThreadMXBean;
25 |
26 | public class DeadlockMonitor extends Thread {
27 | @Override
28 | public void run() {
29 | boolean dead = false;
30 | while (!dead && !interrupted()) {
31 | try {
32 | Thread.sleep(10000);
33 | } catch (InterruptedException e) {
34 | Thread.currentThread().interrupt();
35 | dead = true;
36 | }
37 | ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
38 | long[] ids = tmx.findDeadlockedThreads();
39 | if (ids != null) {
40 | ThreadInfo[] infos = tmx.getThreadInfo(ids, true, true);
41 | System.out.println("The following threads are deadlocked:");
42 | for (ThreadInfo ti : infos) {
43 | System.out.println(ti);
44 | }
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/ClientOnly.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi;
21 |
22 | import java.lang.annotation.Documented;
23 | import java.lang.annotation.ElementType;
24 | import java.lang.annotation.Retention;
25 | import java.lang.annotation.RetentionPolicy;
26 | import java.lang.annotation.Target;
27 |
28 | @Documented
29 | @Target(value = ElementType.METHOD)
30 | @Retention(value = RetentionPolicy.SOURCE)
31 | public @interface ClientOnly {
32 | public String author() default "Afforess";
33 |
34 | public String version() default "1.1";
35 |
36 | public String shortDescription() default "Indicates that the function requires the use of the Spoutcraft client mod to have any effect";
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/Spout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi;
21 |
22 | public class Spout {
23 | private static SpoutServer instance = null;
24 |
25 | public static SpoutServer getServer() {
26 | if (instance == null) {
27 | instance = new SpoutServer();
28 | }
29 | return instance;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/WorldManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi;
21 |
22 | import org.bukkit.World;
23 |
24 | /**
25 | * Internal use only.
26 | *
27 | * Bypass Bukkit's lack of decent API.
28 | */
29 | public interface WorldManager {
30 | public int getWorldHeightBits(World world);
31 |
32 | public int getWorldXShiftBits(World world);
33 |
34 | public int getWorldZShiftBits(World world);
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/block/SpoutWeather.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.block;
21 |
22 | /**
23 | * Types of possible Weather
24 | */
25 | @Deprecated
26 | public enum SpoutWeather {
27 | NONE,
28 | RAIN,
29 | SNOW,
30 | RESET
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/block/design/Axis.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.block.design;
21 |
22 | public enum Axis {
23 | X, Y, Z
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/block/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interfaces for block and chunk related information.
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/chunkdatamanager/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interface for the chunk data manager.
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/chunkstore/SimpleChunkBuffer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.chunkstore;
21 |
22 | import java.io.ByteArrayOutputStream;
23 | import java.io.IOException;
24 |
25 | public class SimpleChunkBuffer extends ByteArrayOutputStream {
26 | final SimpleRegionFile rf;
27 | final int index;
28 |
29 | SimpleChunkBuffer(SimpleRegionFile rf, int index) {
30 | super(1024);
31 | this.rf = rf;
32 | this.index = index;
33 | }
34 |
35 | @Override
36 | public void close() throws IOException {
37 | rf.write(index, buf, count);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/input/KeyBindingEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.input;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.gui.ScreenType;
26 | import org.getspout.spoutapi.keyboard.KeyBinding;
27 | import org.getspout.spoutapi.player.SpoutPlayer;
28 |
29 | public class KeyBindingEvent extends Event {
30 | private static final HandlerList handlers = new HandlerList();
31 | private final KeyBinding binding;
32 | private final SpoutPlayer player;
33 |
34 | public KeyBindingEvent(SpoutPlayer player, KeyBinding binding) {
35 | this.binding = binding;
36 | this.player = player;
37 | }
38 |
39 | public KeyBinding getBinding() {
40 | return binding;
41 | }
42 |
43 | public SpoutPlayer getPlayer() {
44 | return player;
45 | }
46 |
47 | // Convenience method
48 | public ScreenType getScreenType() {
49 | return player.getActiveScreen();
50 | }
51 |
52 | @Override
53 | public HandlerList getHandlers() {
54 | return handlers;
55 | }
56 |
57 | public static HandlerList getHandlerList() {
58 | return handlers;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/input/KeyPressedEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.input;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.gui.ScreenType;
26 | import org.getspout.spoutapi.keyboard.Keyboard;
27 | import org.getspout.spoutapi.player.SpoutPlayer;
28 |
29 | public class KeyPressedEvent extends Event {
30 | private static final HandlerList handlers = new HandlerList();
31 | private final SpoutPlayer player;
32 | private final Keyboard key;
33 | private final ScreenType screenType;
34 |
35 | public KeyPressedEvent(int keyPress, SpoutPlayer player, ScreenType screenType) {
36 | this.player = player;
37 | this.key = Keyboard.getKey(keyPress);
38 | this.screenType = screenType;
39 | }
40 |
41 | public SpoutPlayer getPlayer() {
42 | return player;
43 | }
44 |
45 | public Keyboard getKey() {
46 | return key;
47 | }
48 |
49 | public ScreenType getScreenType() {
50 | return screenType;
51 | }
52 |
53 | @Override
54 | public HandlerList getHandlers() {
55 | return handlers;
56 | }
57 |
58 | public static HandlerList getHandlerList() {
59 | return handlers;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/input/KeyReleasedEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.input;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.gui.ScreenType;
26 | import org.getspout.spoutapi.keyboard.Keyboard;
27 | import org.getspout.spoutapi.player.SpoutPlayer;
28 |
29 | public class KeyReleasedEvent extends Event {
30 | private static final HandlerList handlers = new HandlerList();
31 | private final SpoutPlayer player;
32 | private final Keyboard key;
33 | private final ScreenType screenType;
34 |
35 | public KeyReleasedEvent(int keyPress, SpoutPlayer player, ScreenType screenType) {
36 | this.player = player;
37 | this.key = Keyboard.getKey(keyPress);
38 | this.screenType = screenType;
39 | }
40 |
41 | public SpoutPlayer getPlayer() {
42 | return player;
43 | }
44 |
45 | public Keyboard getKey() {
46 | return key;
47 | }
48 |
49 | public ScreenType getScreenType() {
50 | return screenType;
51 | }
52 |
53 | @Override
54 | public HandlerList getHandlers() {
55 | return handlers;
56 | }
57 |
58 | public static HandlerList getHandlerList() {
59 | return handlers;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/inventory/InventoryPlayerClickEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.inventory;
21 |
22 | import org.bukkit.Location;
23 | import org.bukkit.entity.Player;
24 | import org.bukkit.event.HandlerList;
25 | import org.bukkit.inventory.Inventory;
26 | import org.bukkit.inventory.ItemStack;
27 |
28 | @Deprecated
29 | public class InventoryPlayerClickEvent extends InventoryClickEvent {
30 | private static final HandlerList handlers = new HandlerList();
31 |
32 | public InventoryPlayerClickEvent(Player player, Inventory inventory, InventorySlotType type, ItemStack item, ItemStack cursor, int slot, boolean leftClick, boolean shift, Location location) {
33 | super("InventoryPlayerClickEvent", player, inventory, type, item, cursor, slot, leftClick, shift, location);
34 | }
35 |
36 | @Override
37 | protected int convertSlot(int slot) { // Why?
38 | return slot;
39 | }
40 |
41 | @Override
42 | public HandlerList getHandlers() {
43 | return handlers;
44 | }
45 |
46 | public static HandlerList getHandlerList() {
47 | return handlers;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/inventory/InventorySlotType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.inventory;
21 |
22 | public enum InventorySlotType {
23 | RESULT,
24 | CRAFTING,
25 | HELMET,
26 | ARMOR,
27 | LEGGINGS,
28 | BOOTS,
29 | CONTAINER,
30 | PACK,
31 | QUICKBAR,
32 | OUTSIDE,
33 | FUEL,
34 | SMELTING,
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/inventory/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interfaces for inventory events
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/permission/PermissionEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.permission;
21 |
22 | public interface PermissionEvent {
23 | /**
24 | * Gets the default result of this event, if unmodified.
25 | * @return default result
26 | */
27 | public boolean getDefaultResult();
28 |
29 | /**
30 | * Gets the result of this event.
31 | *
32 | * If true, the action will be allowed
33 | * @return result
34 | */
35 | public boolean getResult();
36 |
37 | /**
38 | * Sets the result of this event.
39 | * @param result to set
40 | */
41 | public void setResult(boolean result);
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/permission/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interfaces for permission events
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/screen/ButtonClickEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.screen;
21 |
22 | import org.bukkit.event.HandlerList;
23 |
24 | import org.getspout.spoutapi.gui.Button;
25 | import org.getspout.spoutapi.gui.Screen;
26 | import org.getspout.spoutapi.gui.ScreenType;
27 | import org.getspout.spoutapi.player.SpoutPlayer;
28 |
29 | public class ButtonClickEvent extends ScreenEvent {
30 | private static final HandlerList handlers = new HandlerList();
31 | private final Button control;
32 |
33 | public ButtonClickEvent(SpoutPlayer player, Screen screen, Button control) {
34 | super("ButtonClickEvent", player, screen, ScreenType.CUSTOM_SCREEN);
35 | this.control = control;
36 | }
37 |
38 | public Button getButton() {
39 | return control;
40 | }
41 |
42 | @Override
43 | public HandlerList getHandlers() {
44 | return handlers;
45 | }
46 |
47 | public static HandlerList getHandlerList() {
48 | return handlers;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/screen/ScreenCloseEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.screen;
21 |
22 | import org.bukkit.event.HandlerList;
23 |
24 | import org.getspout.spoutapi.gui.Screen;
25 | import org.getspout.spoutapi.gui.ScreenType;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public class ScreenCloseEvent extends ScreenEvent {
29 | private static final HandlerList handlers = new HandlerList();
30 |
31 | public ScreenCloseEvent(SpoutPlayer player, Screen screen, ScreenType type) {
32 | super("ScreenCloseEvent", player, screen, type);
33 | }
34 |
35 | @Override
36 | public HandlerList getHandlers() {
37 | return handlers;
38 | }
39 |
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/screen/ScreenEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.screen;
21 |
22 | import org.bukkit.event.Cancellable;
23 | import org.bukkit.event.Event;
24 |
25 | import org.getspout.spoutapi.gui.Screen;
26 | import org.getspout.spoutapi.gui.ScreenType;
27 | import org.getspout.spoutapi.player.SpoutPlayer;
28 |
29 | public abstract class ScreenEvent extends Event implements Cancellable {
30 | protected final Screen screen;
31 | protected final SpoutPlayer player;
32 | protected final ScreenType type;
33 | protected boolean cancel = false;
34 |
35 | protected ScreenEvent(String name, SpoutPlayer player, Screen screen, ScreenType type) {
36 | this.screen = screen;
37 | this.player = player;
38 | this.type = type;
39 | }
40 |
41 | public Screen getScreen() {
42 | return screen;
43 | }
44 |
45 | public ScreenType getScreenType() {
46 | return type;
47 | }
48 |
49 | public SpoutPlayer getPlayer() {
50 | return player;
51 | }
52 |
53 | public boolean isCancelled() {
54 | return cancel;
55 | }
56 |
57 | public void setCancelled(boolean cancel) {
58 | this.cancel = cancel;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/screen/ScreenOpenEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.screen;
21 |
22 | import org.bukkit.event.HandlerList;
23 |
24 | import org.getspout.spoutapi.gui.Screen;
25 | import org.getspout.spoutapi.gui.ScreenType;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public class ScreenOpenEvent extends ScreenEvent {
29 | private static final HandlerList handlers = new HandlerList();
30 |
31 | public ScreenOpenEvent(SpoutPlayer player, Screen screen, ScreenType type) {
32 | super("ScreenOpenEvent", player, screen, type);
33 | }
34 |
35 | @Override
36 | public HandlerList getHandlers() {
37 | return handlers;
38 | }
39 |
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/screen/ScreenshotReceivedEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.screen;
21 |
22 | import java.awt.image.BufferedImage;
23 |
24 | import org.bukkit.event.Event;
25 | import org.bukkit.event.HandlerList;
26 |
27 | import org.getspout.spoutapi.player.SpoutPlayer;
28 |
29 | public class ScreenshotReceivedEvent extends Event {
30 | private static final HandlerList handlers = new HandlerList();
31 | private final BufferedImage screenshot;
32 | private final SpoutPlayer player;
33 |
34 | public ScreenshotReceivedEvent(SpoutPlayer sp, BufferedImage image) {
35 | screenshot = image;
36 | player = sp;
37 | }
38 |
39 | public BufferedImage getScreenshot() {
40 | return screenshot;
41 | }
42 |
43 | public SpoutPlayer getPlayer() {
44 | return player;
45 | }
46 |
47 | @Override
48 | public HandlerList getHandlers() {
49 | return handlers;
50 | }
51 |
52 | public static HandlerList getHandlerList() {
53 | return handlers;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/slot/SlotEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.slot;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | import org.getspout.spoutapi.gui.Slot;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public abstract class SlotEvent extends Event {
29 | protected final Slot slot;
30 | protected final SpoutPlayer player;
31 | protected final ItemStack stack;
32 | protected boolean cancel = false;
33 |
34 | protected SlotEvent(SpoutPlayer player, Slot slot, ItemStack stack, boolean cancelled) {
35 | this.slot = slot;
36 | this.player = player;
37 | this.stack = stack;
38 | cancel = cancelled;
39 | }
40 |
41 | public Slot getSlot() {
42 | return slot;
43 | }
44 |
45 | public SpoutPlayer getPlayer() {
46 | return player;
47 | }
48 |
49 | public ItemStack getItemStack() {
50 | return stack;
51 | }
52 |
53 | public boolean isCancelled() {
54 | return cancel;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/slot/SlotExchangeEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.slot;
21 |
22 | import org.bukkit.event.HandlerList;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | import org.getspout.spoutapi.gui.Slot;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public class SlotExchangeEvent extends SlotEvent {
29 | private static final HandlerList handlers = new HandlerList();
30 | private final ItemStack cursor;
31 |
32 | public SlotExchangeEvent(SpoutPlayer player, Slot slot, ItemStack current, ItemStack cursor, boolean cancel) {
33 | super(player, slot, current, cancel);
34 | this.cursor = cursor;
35 | }
36 |
37 | @Override
38 | public HandlerList getHandlers() {
39 | return handlers;
40 | }
41 |
42 | public static HandlerList getHandlerList() {
43 | return handlers;
44 | }
45 |
46 | /**
47 | * This gets the ItemStack currently in the Slot.
48 | */
49 | @Override
50 | public ItemStack getItemStack() {
51 | return super.getItemStack();
52 | }
53 |
54 | public ItemStack getCursorItemStack() {
55 | return cursor;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/slot/SlotPutEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.slot;
21 |
22 | import org.bukkit.event.HandlerList;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | import org.getspout.spoutapi.gui.Slot;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public class SlotPutEvent extends SlotEvent {
29 | private static final HandlerList handlers = new HandlerList();
30 |
31 | public SlotPutEvent(SpoutPlayer player, Slot slot, ItemStack stack, boolean cancel) {
32 | super(player, slot, stack, cancel);
33 | }
34 |
35 | @Override
36 | public HandlerList getHandlers() {
37 | return handlers;
38 | }
39 |
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/slot/SlotShiftClickEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.slot;
21 |
22 | import org.bukkit.event.HandlerList;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | import org.getspout.spoutapi.gui.Slot;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public class SlotShiftClickEvent extends SlotEvent {
29 | private static final HandlerList handlers = new HandlerList();
30 |
31 | public SlotShiftClickEvent(SpoutPlayer player, Slot slot) {
32 | super(player, slot, null, false);
33 | }
34 |
35 | @Override
36 | public HandlerList getHandlers() {
37 | return handlers;
38 | }
39 |
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 |
44 | /**
45 | * This returns null since shift-clicks are independent
46 | * of the ItemStack in the cursor.
47 | */
48 | @Override
49 | public ItemStack getItemStack() {
50 | return super.getItemStack();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/slot/SlotTakeEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.slot;
21 |
22 | import org.bukkit.event.HandlerList;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | import org.getspout.spoutapi.gui.Slot;
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public class SlotTakeEvent extends SlotEvent {
29 | private static final HandlerList handlers = new HandlerList();
30 |
31 | public SlotTakeEvent(SpoutPlayer player, Slot slot, ItemStack stack, boolean cancel) {
32 | super(player, slot, stack, cancel);
33 | }
34 |
35 | @Override
36 | public HandlerList getHandlers() {
37 | return handlers;
38 | }
39 |
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/sound/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interfaces for audio and other music related events
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/spout/SpoutCraftEnableEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.spout;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.player.SpoutPlayer;
26 |
27 | public class SpoutCraftEnableEvent extends Event {
28 | private static final HandlerList handlers = new HandlerList();
29 | private final SpoutPlayer player;
30 |
31 | public SpoutCraftEnableEvent(SpoutPlayer player) {
32 | this.player = player;
33 | }
34 |
35 | /**
36 | * Returns the player who just had their Spout SinglePlayer Mod enabled
37 | * @return player
38 | */
39 | public SpoutPlayer getPlayer() {
40 | return player;
41 | }
42 |
43 | @Override
44 | public HandlerList getHandlers() {
45 | return handlers;
46 | }
47 |
48 | public static HandlerList getHandlerList() {
49 | return handlers;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/spout/SpoutcraftBuildSetEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.spout;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.player.SpoutPlayer;
26 |
27 | public class SpoutcraftBuildSetEvent extends Event {
28 | private static final HandlerList handlers = new HandlerList();
29 | private final SpoutPlayer player;
30 | private final int build;
31 |
32 | public SpoutcraftBuildSetEvent(SpoutPlayer player, int build) {
33 | this.player = player;
34 | this.build = build;
35 | }
36 |
37 | /**
38 | * Gets the player associated with this event.
39 | * @return
40 | */
41 | public SpoutPlayer getPlayer() {
42 | return player;
43 | }
44 |
45 | /**
46 | * Gets the build associated with this event.
47 | * @return
48 | */
49 | public int getBuild() {
50 | return build;
51 | }
52 |
53 | @Override
54 | public HandlerList getHandlers() {
55 | return handlers;
56 | }
57 |
58 | public static HandlerList getHandlerList() {
59 | return handlers;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/spout/SpoutcraftFailedEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.spout;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.player.SpoutPlayer;
26 |
27 | public class SpoutcraftFailedEvent extends Event {
28 | private static final HandlerList handlers = new HandlerList();
29 | private final SpoutPlayer player;
30 |
31 | public SpoutcraftFailedEvent(SpoutPlayer player) {
32 | this.player = player;
33 | }
34 |
35 | /**
36 | * Returns the player who just had their Spout SinglePlayer Mod enabled
37 | * @return player
38 | */
39 | public SpoutPlayer getPlayer() {
40 | return player;
41 | }
42 |
43 | @Override
44 | public HandlerList getHandlers() {
45 | return handlers;
46 | }
47 |
48 | public static HandlerList getHandlerList() {
49 | return handlers;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/event/spout/SpoutcraftPreCacheCompletedEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.event.spout;
21 |
22 | import org.bukkit.event.Event;
23 | import org.bukkit.event.HandlerList;
24 |
25 | import org.getspout.spoutapi.player.SpoutPlayer;
26 |
27 | public class SpoutcraftPreCacheCompletedEvent extends Event {
28 | private static final HandlerList handlers = new HandlerList();
29 | private final SpoutPlayer player;
30 |
31 | public SpoutcraftPreCacheCompletedEvent(SpoutPlayer player) {
32 | this.player = player;
33 | }
34 |
35 | /**
36 | * Returns the player who just had their Spout SinglePlayer Mod enabled
37 | * @return player
38 | */
39 | public SpoutPlayer getPlayer() {
40 | return player;
41 | }
42 |
43 | @Override
44 | public HandlerList getHandlers() {
45 | return handlers;
46 | }
47 |
48 | public static HandlerList getHandlerList() {
49 | return handlers;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/AbstractListModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | import java.util.Collections;
23 | import java.util.HashSet;
24 | import java.util.Set;
25 |
26 | public abstract class AbstractListModel {
27 | private HashSet views = new HashSet();
28 |
29 | public abstract ListWidgetItem getItem(int row);
30 |
31 | public abstract int getSize();
32 |
33 | public abstract void onSelected(int item, boolean doubleClick);
34 |
35 | public void addView(GenericListView view) {
36 | views.add(view);
37 | }
38 |
39 | public void removeView(GenericListView view) {
40 | views.remove(view);
41 | }
42 |
43 | public void sizeChanged() {
44 | for (GenericListView view : views) {
45 | view.sizeChanged();
46 | }
47 | }
48 |
49 | public Set getViews() {
50 | return Collections.unmodifiableSet(views);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/CheckBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | /**
23 | * This defines a simple checkbox widget.
24 | */
25 | public interface CheckBox extends Button {
26 | public boolean isChecked();
27 |
28 | public CheckBox setChecked(boolean checked);
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/ComboBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | import java.util.List;
23 |
24 | public interface ComboBox extends Button {
25 | public ComboBox setItems(List items);
26 |
27 | public List getItems();
28 |
29 | public ComboBox openList();
30 |
31 | public ComboBox closeList();
32 |
33 | public String getSelectedItem();
34 |
35 | public int getSelectedRow();
36 |
37 | public ComboBox setSelection(int row);
38 |
39 | public void onSelectionChanged(int i, String text);
40 |
41 | public boolean isOpen();
42 |
43 | /**
44 | * Sets the format of the text on the button. Default is "%text%: %selected%"
45 | *
46 | * %text% will be replaced with whatever can be obtained by Button.getText()
47 | * %selected% will be replaced with the text of the selected item
48 | * @param format the format of the text on the button
49 | * @return the instance
50 | */
51 | public ComboBox setFormat(String format);
52 |
53 | public String getFormat();
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/ContainerType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | /**
23 | * This defines the layout for Containers.
24 | */
25 | public enum ContainerType {
26 | VERTICAL,
27 | HORIZONTAL,
28 | OVERLAY
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/EntityWidget.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | /**
23 | * This is used to display any in-game entity on the screen.
24 | */
25 | public interface EntityWidget extends Widget {
26 | /**
27 | * Sets the id of this entity
28 | * @param id of the entity
29 | * @return this
30 | */
31 | public EntityWidget setEntityId(int id);
32 |
33 | /**
34 | * Gets the id of this entity
35 | * @return the id of this entity
36 | */
37 | public int getEntityId();
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/ExpBar.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | import java.util.UUID;
23 |
24 | public class ExpBar extends GenericWidget {
25 | public ExpBar() {
26 | super();
27 | setX(427 / 2 - 91); // 122
28 | setY(211);
29 | setWidth(getWidth()); // Don't know the default - ignored, but prevents warnings...
30 | setAnchor(WidgetAnchor.BOTTOM_CENTER);
31 | }
32 |
33 | @Override
34 | public UUID getId() {
35 | return new UUID(0, 6);
36 | }
37 |
38 | @Override
39 | public WidgetType getType() {
40 | return WidgetType.ExpBar;
41 | }
42 |
43 | @Override
44 | public int getVersion() {
45 | return super.getVersion() + 1;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/GenericOverlayScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | public class GenericOverlayScreen extends GenericScreen implements OverlayScreen {
23 | ScreenType screenType;
24 |
25 | public GenericOverlayScreen(int entityId, ScreenType type) {
26 | super(entityId);
27 | screenType = type;
28 | }
29 |
30 | @Override
31 | public WidgetType getType() {
32 | return WidgetType.OverlayScreen;
33 | }
34 |
35 | @Override
36 | public ScreenType getScreenType() {
37 | return screenType;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/GenericRectangle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | /**
23 | * Merged back into GenericGradient
24 | */
25 | @Deprecated
26 | public class GenericRectangle extends GenericGradient {
27 | public GenericRectangle() {
28 | }
29 |
30 | public GenericRectangle(Color color) {
31 | super(color);
32 | }
33 |
34 | @Override
35 | public GenericGradient setTopColor(Color color) {
36 | return (GenericGradient) setColor(color);
37 | }
38 |
39 | @Override
40 | public GenericGradient setBottomColor(Color color) {
41 | return (GenericGradient) setColor(color);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/Orientation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | import java.util.HashMap;
23 |
24 | /**
25 | * This is used to define the orientation for Scrollable widgets.
26 | */
27 | public enum Orientation {
28 | /**
29 | * Horizontal axis (left-right)
30 | */
31 | HORIZONTAL(0),
32 | /**
33 | * Vertical axis (top-bottom)
34 | */
35 | VERTICAL(1);
36 | private final int id;
37 |
38 | Orientation(int id) {
39 | this.id = id;
40 | }
41 |
42 | public int getId() {
43 | return id;
44 | }
45 |
46 | private static final HashMap lookupId = new HashMap();
47 |
48 | static {
49 | for (Orientation t : values()) {
50 | lookupId.put(t.getId(), t);
51 | }
52 | }
53 |
54 | public static Orientation getOrientationFromId(int id) {
55 | return lookupId.get(id);
56 | }
57 |
58 | public Orientation getOther() {
59 | switch (this) {
60 | case HORIZONTAL:
61 | return VERTICAL;
62 | case VERTICAL:
63 | return HORIZONTAL;
64 | }
65 | return null;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/OverlayScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | public interface OverlayScreen extends Screen {
23 | }
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/PopupScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | import org.bukkit.inventory.ItemStack;
23 |
24 | /**
25 | * The GenericPopup class creates an mouseable area where you can put multiple
26 | * Widgets.
27 | *
28 | * Optionally the background of the popup can be darkened to make it more
29 | * obvious that it is a popup.
30 | */
31 | public interface PopupScreen extends Screen {
32 | /**
33 | * Is true if the popup screen has no transparency layer
34 | * @return transparency
35 | */
36 | public boolean isTransparent();
37 |
38 | /**
39 | * Sets the transparency layer
40 | * @param value to set
41 | * @return popupscreen
42 | */
43 | public PopupScreen setTransparent(boolean value);
44 |
45 | /**
46 | * Closes the screen. Functionally equivelent to InGameHUD.closePopup()
47 | * @return true if the screen was closed
48 | */
49 | public boolean close();
50 |
51 | /**
52 | * When the screen is closed, this method is called to handle the
53 | * ItemStack that the player is dragging.
54 | * @param itemOnCursor ItemStack on the cursor.
55 | */
56 | public void handleItemOnCursor(ItemStack itemOnCursor);
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/RadioButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | /**
23 | * This is a simple radio button, which does not know anything about any other
24 | * radio buttons on the screen.
25 | */
26 | public interface RadioButton extends Button {
27 | public boolean isSelected();
28 |
29 | public RadioButton setSelected(boolean selected);
30 |
31 | public int getGroup();
32 |
33 | public RadioButton setGroup(int group);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/ScrollBarPolicy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | import java.util.HashMap;
23 |
24 | /**
25 | * When a Scrollable scrollbar will be shown.
26 | */
27 | public enum ScrollBarPolicy {
28 | /**
29 | * Shows the scrollbar when getMaximumScrollPosition is greater than 0
30 | */
31 | SHOW_IF_NEEDED(0),
32 | /**
33 | * Never show the scrollbar. However, you'll still be able to scroll with
34 | * the scroll wheel or your trackpad or with arrow keys if the widget
35 | * implemented that (like the list widget).
36 | */
37 | SHOW_NEVER(1),
38 | /**
39 | * Always show the scrollbar
40 | */
41 | SHOW_ALWAYS(2);
42 | private final int id;
43 | private static HashMap ids = new HashMap();
44 |
45 | ScrollBarPolicy(int id) {
46 | this.id = id;
47 | }
48 |
49 | public int getId() {
50 | return id;
51 | }
52 |
53 | public static ScrollBarPolicy getById(int id) {
54 | return ids.get(id);
55 | }
56 |
57 | static {
58 | for (ScrollBarPolicy s : values()) {
59 | ids.put(s.id, s);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/gui/SolidBackground.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.gui;
21 |
22 | public interface SolidBackground {
23 | /**
24 | * Not implemented.
25 | * @param red
26 | * @param green
27 | * @param blue
28 | * @param alpha
29 | */
30 | public void setColor(float red, float green, float blue, float alpha);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/inventory/CraftingInventory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.inventory;
21 |
22 | import org.bukkit.inventory.Inventory;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | public interface CraftingInventory extends Inventory {
26 | /**
27 | * Gets the item in the result slot of the crafting table
28 | * @return result
29 | */
30 | public ItemStack getResult();
31 |
32 | /**
33 | * Gets the matrix of items in the crafting table
34 | * @return matrix of items
35 | */
36 | public ItemStack[] getMatrix();
37 |
38 | /**
39 | * Sets the result item in the result slot of the crafting table
40 | * @param newResult to set
41 | */
42 | public void setResult(ItemStack newResult);
43 |
44 | /**
45 | * Sets the matrix of items in the crafting table
46 | * @param contents to set
47 | */
48 | public void setMatrix(ItemStack[] contents);
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/inventory/DoubleChestInventory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.inventory;
21 |
22 | import org.bukkit.block.Block;
23 | import org.bukkit.block.BlockFace;
24 | import org.bukkit.inventory.Inventory;
25 |
26 | public interface DoubleChestInventory extends Inventory {
27 | /**
28 | * Gets the block containing the top half of the double chest
29 | * @return top half
30 | */
31 | public Block getTopHalf();
32 |
33 | /**
34 | * Gets the block containing the bottom half of the double chest
35 | * @return bottom half
36 | */
37 | public Block getBottomHalf();
38 |
39 | /**
40 | * Gets the left half of the double chest
41 | * @return left side
42 | */
43 | public Block getLeftSide();
44 |
45 | /**
46 | * Gets the right half of the double chest
47 | * @return right side
48 | */
49 | public Block getRightSide();
50 |
51 | /**
52 | * Gets the direction of the front buckle on the double chest
53 | * @return buckle direction
54 | */
55 | public BlockFace getDirection();
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/inventory/ItemMapRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.inventory;
21 |
22 | public interface ItemMapRunnable {
23 | public void run(ItemMap itemMap, String key, int id);
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/inventory/SpoutPlayerInventory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.inventory;
21 |
22 | import org.bukkit.inventory.PlayerInventory;
23 |
24 | import org.getspout.spoutapi.material.Material;
25 |
26 | public interface SpoutPlayerInventory extends PlayerInventory, CraftingInventory {
27 | public int getItemInHandSlot();
28 | public void remove(Material material);
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/io/CRCStoreRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.io;
21 |
22 | public interface CRCStoreRunnable extends Runnable {
23 | public void setCRC(Long CRC);
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/io/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides utility methods for files.
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/keyboard/BindingExecutionDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.keyboard;
21 |
22 | import org.getspout.spoutapi.event.input.KeyBindingEvent;
23 |
24 | /**
25 | * Implement this interface to provide your custom action what should happen when a user presses a registered keybinding.
26 | * Register your keybinding using the KeyBindingManager
27 | * @see KeyBindingManager
28 | */
29 | public interface BindingExecutionDelegate {
30 | /**
31 | * Called when the key bound to the delegate is pressed
32 | * @param event args
33 | */
34 | public void keyPressed(KeyBindingEvent event);
35 |
36 | /**
37 | * Called when the key bound to the delegate is released
38 | * @param event args
39 | */
40 | public void keyReleased(KeyBindingEvent event);
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/keyboard/KeyBindingManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.keyboard;
21 |
22 | import java.util.UUID;
23 |
24 | import org.bukkit.plugin.Plugin;
25 |
26 | import org.getspout.spoutapi.player.SpoutPlayer;
27 |
28 | public interface KeyBindingManager {
29 | /**
30 | * Registers a new kind binding
31 | * @param id unique id that represents your binding. IT MUST BE UNIQUE!
32 | * @param defaultKey for this binding.
33 | * @param description of this key binding, that players will see.
34 | * @param callback the class that will receive the event callbacks.
35 | * @param plugin that registered this binding.
36 | * @throws IllegalArgumentException if the id passed is not unique.
37 | */
38 | public void registerBinding(String id, Keyboard defaultKey, String description, BindingExecutionDelegate callback, Plugin plugin) throws IllegalArgumentException;
39 |
40 | /**
41 | * Internal use only
42 | */
43 | public void summonKey(UUID uniqueId, SpoutPlayer player, Keyboard key, boolean pressed);
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/keyboard/KeyboardBinding.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.keyboard;
21 |
22 | import org.getspout.spoutapi.player.SpoutPlayer;
23 |
24 | /**
25 | * Please use the KeyBinding class instead
26 | */
27 | @Deprecated
28 | public interface KeyboardBinding {
29 | @Deprecated
30 | public void onPreKeyPress(SpoutPlayer player);
31 |
32 | @Deprecated
33 | public void onPostKeyPress(SpoutPlayer player);
34 |
35 | @Deprecated
36 | public void onPreKeyRelease(SpoutPlayer player);
37 |
38 | @Deprecated
39 | public void onPostKeyRelease(SpoutPlayer player);
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Armor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Armor extends Item {
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Block.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | import org.getspout.spoutapi.sound.SoundEffect;
23 |
24 | public interface Block extends Material {
25 | public SoundEffect getStepSound();
26 |
27 | public Block setStepSound(SoundEffect sound);
28 |
29 | public float getFriction();
30 |
31 | public Block setFriction(float slip);
32 |
33 | public float getHardness();
34 |
35 | public Block setHardness(float hardness);
36 |
37 | public boolean isOpaque();
38 |
39 | public Block setOpaque(boolean opaque);
40 |
41 | public int getLightLevel();
42 |
43 | public Block setLightLevel(int level);
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Food.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Food extends Item {
23 | public int getHungerRestored();
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Item.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Item extends Material {
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Liquid.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Liquid extends Block {
23 | public boolean isFlowing();
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Material.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Material {
23 | public int getRawId();
24 |
25 | public int getRawData();
26 |
27 | public boolean hasSubtypes();
28 |
29 | public String getNotchianName();
30 |
31 | public String getName();
32 |
33 | public void setName(String name);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Plant.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Plant extends Block {
23 | public boolean isHasGrowthStages();
24 |
25 | public int getNumGrowthStages();
26 |
27 | public int getMinimumLightToGrow();
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/SolidBlock.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface SolidBlock extends Block {
23 | public boolean isFallingBlock();
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Tool.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Tool extends Item {
23 | public Tool setMaxDurability(short durability);
24 |
25 | public short getMaxDurability();
26 |
27 | public float getStrengthModifier(Block block);
28 |
29 | public Tool setStrengthModifier(Block block, float modifier);
30 |
31 | public Block[] getStrengthModifiedBlocks();
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/Weapon.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material;
21 |
22 | public interface Weapon extends Item {
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/DoubleSlabs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.SolidBlock;
23 |
24 | public class DoubleSlabs extends GenericBlock implements SolidBlock {
25 | public DoubleSlabs(String name, int id, int data) {
26 | super(name, id, data);
27 | }
28 |
29 | @Override
30 | public boolean isFallingBlock() {
31 | return false;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/GenericLiquid.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.Liquid;
23 |
24 | public class GenericLiquid extends GenericBlock implements Liquid {
25 | private final boolean flowing;
26 |
27 | public GenericLiquid(String name, int id, boolean flowing) {
28 | super(name, id);
29 | this.flowing = flowing;
30 | }
31 |
32 | @Override
33 | public boolean isFlowing() {
34 | return flowing;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/Grass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.Plant;
23 |
24 | public class Grass extends GenericBlock implements Plant {
25 | public Grass(String name) {
26 | super(name, 2);
27 | }
28 |
29 | @Override
30 | public boolean isHasGrowthStages() {
31 | return false;
32 | }
33 |
34 | @Override
35 | public int getNumGrowthStages() {
36 | return 0;
37 | }
38 |
39 | @Override
40 | public int getMinimumLightToGrow() {
41 | return 9;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/LongGrass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.Plant;
23 |
24 | public class LongGrass extends GenericBlock implements Plant {
25 | public LongGrass(String name, int id, int data) {
26 | super(name, id, data);
27 | }
28 |
29 | @Override
30 | public boolean isHasGrowthStages() {
31 | return false;
32 | }
33 |
34 | @Override
35 | public int getNumGrowthStages() {
36 | return 0;
37 | }
38 |
39 | @Override
40 | public int getMinimumLightToGrow() {
41 | return 0;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/Sapling.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.Plant;
23 |
24 | public class Sapling extends GenericBlock implements Plant {
25 | public Sapling(String name, int data) {
26 | super(name, 6, data);
27 | }
28 |
29 | @Override
30 | public boolean isHasGrowthStages() {
31 | return true;
32 | }
33 |
34 | @Override
35 | public int getNumGrowthStages() {
36 | return 3;
37 | }
38 |
39 | @Override
40 | public int getMinimumLightToGrow() {
41 | return 8;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/Slab.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.SolidBlock;
23 |
24 | public class Slab extends GenericBlock implements SolidBlock {
25 | public Slab(String name, int id, int data) {
26 | super(name, id, data);
27 | }
28 |
29 | @Override
30 | public boolean isFallingBlock() {
31 | return false;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/Solid.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.SolidBlock;
23 |
24 | public class Solid extends GenericBlock implements SolidBlock {
25 | private final boolean falling;
26 |
27 | public Solid(String name, int id, int data, boolean falling) {
28 | super(name, id, data);
29 | this.falling = falling;
30 | }
31 |
32 | public Solid(String name, int id, boolean falling) {
33 | super(name, id, 0);
34 | this.falling = falling;
35 | }
36 |
37 | public Solid(String name, int id) {
38 | super(name, id, 0);
39 | this.falling = false;
40 | }
41 |
42 | public Solid(String name, int id, int data) {
43 | super(name, id, data);
44 | this.falling = false;
45 | }
46 |
47 | @Override
48 | public boolean isFallingBlock() {
49 | return falling;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/StoneBricks.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | public class StoneBricks extends GenericBlock {
23 | public StoneBricks(String name, int id, int data) {
24 | super(name, id, data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/Tree.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.Plant;
23 |
24 | public class Tree extends GenericBlock implements Plant {
25 | public Tree(String name, int id, int data) {
26 | super(name, id, data);
27 | }
28 |
29 | @Override
30 | public boolean isHasGrowthStages() {
31 | return false;
32 | }
33 |
34 | @Override
35 | public int getNumGrowthStages() {
36 | return 0;
37 | }
38 |
39 | @Override
40 | public int getMinimumLightToGrow() {
41 | return 0;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/Wool.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.block;
21 |
22 | import org.getspout.spoutapi.material.SolidBlock;
23 |
24 | public class Wool extends GenericBlock implements SolidBlock {
25 | public Wool(String name, int id, int data) {
26 | super(name, id, data);
27 | }
28 |
29 | @Override
30 | public boolean isFallingBlock() {
31 | return false;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/block/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the implementation of materials in Minecraft
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/Coal.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | public class Coal extends GenericItem {
23 | public Coal(String name, int id, int data) {
24 | super(name, id, data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/Dye.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | public class Dye extends GenericItem {
23 | public Dye(String name, int id, int data) {
24 | super(name, id, data, true);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/GenericArmor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | import org.getspout.spoutapi.material.Armor;
23 |
24 | public class GenericArmor extends GenericItem implements Armor {
25 | public GenericArmor(String name, int id) {
26 | super(name, id);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/GenericFood.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | import org.getspout.spoutapi.material.Food;
23 |
24 | public class GenericFood extends GenericItem implements Food {
25 | private final int hunger;
26 |
27 | public GenericFood(String name, int id, int hunger) {
28 | super(name, id);
29 | this.hunger = hunger;
30 | }
31 |
32 | @Override
33 | public int getHungerRestored() {
34 | return hunger;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/GenericTool.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | import org.getspout.spoutapi.material.Block;
23 | import org.getspout.spoutapi.material.Tool;
24 |
25 | public class GenericTool extends GenericItem implements Tool {
26 | public GenericTool(String name, int id) {
27 | super(name, id);
28 | }
29 |
30 | @Override
31 | public Tool setMaxDurability(short durability) {
32 | return this;
33 | }
34 |
35 | @Override
36 | public short getMaxDurability() {
37 | return 0;
38 | }
39 |
40 | @Override
41 | public float getStrengthModifier(Block block) {
42 | // TODO Auto-generated method stub
43 | return 0;
44 | }
45 |
46 | @Override
47 | public Tool setStrengthModifier(Block block, float modifier) {
48 | // TODO Auto-generated method stub
49 | return this;
50 | }
51 |
52 | @Override
53 | public Block[] getStrengthModifiedBlocks() {
54 | // TODO Auto-generated method stub
55 | return null;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/GenericWeapon.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | import org.getspout.spoutapi.material.Weapon;
23 |
24 | public class GenericWeapon extends GenericItem implements Weapon {
25 | public GenericWeapon(String name, int id) {
26 | super(name, id);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/Potion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | public class Potion extends GenericItem {
23 | public Potion(String name, int id, int data) {
24 | super(name, id, data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/SpawnEgg.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.material.item;
21 |
22 | public class SpawnEgg extends GenericItem {
23 | public SpawnEgg(String name, int id, int data) {
24 | super(name, id, data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/item/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the implementation of items in Minecraft
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/material/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interface for materials in Minecraft
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/CompressablePacket.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | @Deprecated
23 | public interface CompressablePacket extends SpoutPacket {
24 | public void compress();
25 |
26 | public void decompress();
27 |
28 | public boolean isCompressed();
29 | }
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/CompressiblePacket.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | @SuppressWarnings("deprecation")
23 | public interface CompressiblePacket extends CompressablePacket {
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketAirTime.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 |
24 | import org.getspout.spoutapi.io.SpoutInputStream;
25 | import org.getspout.spoutapi.io.SpoutOutputStream;
26 |
27 | public class PacketAirTime implements SpoutPacket {
28 | public int airTime;
29 | public int air;
30 |
31 | public PacketAirTime() {
32 | }
33 |
34 | public PacketAirTime(int maxTime, int time) {
35 | this.airTime = maxTime;
36 | this.air = time;
37 | }
38 |
39 | @Override
40 | public void readData(SpoutInputStream input) throws IOException {
41 | this.airTime = input.readInt();
42 | this.air = input.readInt();
43 | }
44 |
45 | @Override
46 | public void writeData(SpoutOutputStream output) throws IOException {
47 | output.writeInt(this.airTime);
48 | output.writeInt(this.air);
49 | }
50 |
51 | @Override
52 | public void run(int id) {
53 | }
54 |
55 | @Override
56 | public void failure(int id) {
57 | }
58 |
59 | @Override
60 | public PacketType getPacketType() {
61 | return PacketType.PacketAirTime;
62 | }
63 |
64 | @Override
65 | public int getVersion() {
66 | return 0;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketEntityTitle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 |
24 | import org.getspout.spoutapi.io.SpoutInputStream;
25 | import org.getspout.spoutapi.io.SpoutOutputStream;
26 |
27 | public class PacketEntityTitle implements SpoutPacket {
28 | public String title;
29 | public int entityId;
30 |
31 | public PacketEntityTitle() {
32 | }
33 |
34 | public PacketEntityTitle(int entityId, String title) {
35 | this.entityId = entityId;
36 | this.title = title;
37 | }
38 |
39 | @Override
40 | public void readData(SpoutInputStream input) throws IOException {
41 | entityId = input.readInt();
42 | title = input.readString();
43 | }
44 |
45 | @Override
46 | public void writeData(SpoutOutputStream output) throws IOException {
47 | output.writeInt(entityId);
48 | output.writeString(title);
49 | }
50 |
51 | @Override
52 | public void run(int id) {
53 | }
54 |
55 | @Override
56 | public void failure(int id) {
57 | }
58 |
59 | @Override
60 | public PacketType getPacketType() {
61 | return PacketType.PacketEntityTitle;
62 | }
63 |
64 | @Override
65 | public int getVersion() {
66 | return 0;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketNotification.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 |
24 | import org.getspout.spoutapi.io.SpoutInputStream;
25 | import org.getspout.spoutapi.io.SpoutOutputStream;
26 |
27 | public class PacketNotification extends PacketAlert {
28 | protected int time;
29 | protected short data;
30 |
31 | public PacketNotification() {
32 | }
33 |
34 | public PacketNotification(String title, String message, int itemId, short data, int time) {
35 | super(title, message, itemId);
36 | this.time = time;
37 | this.data = data;
38 | }
39 |
40 | @Override
41 | public void readData(SpoutInputStream input) throws IOException {
42 | super.readData(input);
43 | this.data = input.readShort();
44 | this.time = input.readInt();
45 | }
46 |
47 | @Override
48 | public void writeData(SpoutOutputStream output) throws IOException {
49 | super.writeData(output);
50 | output.writeShort(data);
51 | output.writeInt(time);
52 | }
53 |
54 | @Override
55 | public PacketType getPacketType() {
56 | return PacketType.PacketNotification;
57 | }
58 |
59 | @Override
60 | public int getVersion() {
61 | return 0;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketOpenScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 |
24 | import org.getspout.spoutapi.gui.ScreenType;
25 | import org.getspout.spoutapi.io.SpoutInputStream;
26 | import org.getspout.spoutapi.io.SpoutOutputStream;
27 |
28 | public class PacketOpenScreen implements SpoutPacket {
29 | ScreenType type = null;
30 |
31 | public PacketOpenScreen(ScreenType type) {
32 | this.type = type;
33 | }
34 |
35 | @Override
36 | public void readData(SpoutInputStream input) throws IOException {
37 | type = ScreenType.getType(input.readInt());
38 | }
39 |
40 | @Override
41 | public void writeData(SpoutOutputStream output) throws IOException {
42 | output.writeInt(type.getCode());
43 | }
44 |
45 | @Override
46 | public void run(int playerId) {
47 | }
48 |
49 | @Override
50 | public void failure(int playerId) {
51 | }
52 |
53 | @Override
54 | public PacketType getPacketType() {
55 | return PacketType.PacketOpenScreen;
56 | }
57 |
58 | @Override
59 | public int getVersion() {
60 | return 0;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketOpenSignGUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 |
24 | import org.getspout.spoutapi.io.SpoutInputStream;
25 | import org.getspout.spoutapi.io.SpoutOutputStream;
26 |
27 | public class PacketOpenSignGUI implements SpoutPacket {
28 | int x, y, z;
29 |
30 | public PacketOpenSignGUI(int x, int y, int z) {
31 | this.x = x;
32 | this.y = y;
33 | this.z = z;
34 | }
35 |
36 | @Override
37 | public void readData(SpoutInputStream input) throws IOException {
38 | x = input.readInt();
39 | y = input.readInt();
40 | z = input.readInt();
41 | }
42 |
43 | @Override
44 | public void writeData(SpoutOutputStream output) throws IOException {
45 | output.writeInt(x);
46 | output.writeInt(y);
47 | output.writeInt(z);
48 | }
49 |
50 | @Override
51 | public void run(int playerId) {
52 | }
53 |
54 | @Override
55 | public void failure(int playerId) {
56 | }
57 |
58 | @Override
59 | public PacketType getPacketType() {
60 | return PacketType.PacketOpenSignGUI;
61 | }
62 |
63 | @Override
64 | public int getVersion() {
65 | return 0;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketTexturePack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 |
24 | import org.getspout.spoutapi.io.SpoutInputStream;
25 | import org.getspout.spoutapi.io.SpoutOutputStream;
26 |
27 | public class PacketTexturePack implements SpoutPacket {
28 | private String url;
29 | private long expectedCRC;
30 |
31 | public PacketTexturePack() {
32 | }
33 |
34 | public PacketTexturePack(String url, long expectedCRC) {
35 | this.url = url;
36 | this.expectedCRC = expectedCRC;
37 | }
38 |
39 | @Override
40 | public void readData(SpoutInputStream input) throws IOException {
41 | url = input.readString();
42 | expectedCRC = input.readLong();
43 | }
44 |
45 | @Override
46 | public void writeData(SpoutOutputStream output) throws IOException {
47 | output.writeString(url);
48 | output.writeLong(expectedCRC);
49 | }
50 |
51 | @Override
52 | public void run(int PlayerId) {
53 | }
54 |
55 | @Override
56 | public void failure(int id) {
57 | }
58 |
59 | @Override
60 | public PacketType getPacketType() {
61 | return PacketType.PacketTexturePack;
62 | }
63 |
64 | @Override
65 | public int getVersion() {
66 | return 2;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/PacketWidgetRemove.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | import java.io.IOException;
23 | import java.util.UUID;
24 |
25 | import org.getspout.spoutapi.gui.Widget;
26 | import org.getspout.spoutapi.gui.WidgetType;
27 | import org.getspout.spoutapi.io.SpoutInputStream;
28 | import org.getspout.spoutapi.io.SpoutOutputStream;
29 |
30 | public class PacketWidgetRemove implements SpoutPacket {
31 | protected Widget widget;
32 |
33 | public PacketWidgetRemove() {
34 | }
35 |
36 | public PacketWidgetRemove(Widget widget, UUID screen) {
37 | this.widget = widget;
38 | }
39 |
40 | @Override
41 | public void readData(SpoutInputStream input) throws IOException {
42 | }
43 |
44 | @Override
45 | public void writeData(SpoutOutputStream output) throws IOException {
46 | output.writeUUID(widget.getId());
47 | }
48 |
49 | @Override
50 | public void run(int PlayerId) {
51 | }
52 |
53 | @Override
54 | public void failure(int id) {
55 | }
56 |
57 | @Override
58 | public PacketType getPacketType() {
59 | return PacketType.PacketWidgetRemove;
60 | }
61 |
62 | @Override
63 | public int getVersion() {
64 | return 1;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/ScreenAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet;
21 |
22 | public enum ScreenAction {
23 | Open(0),
24 | Close(1),
25 | Force_Close(2),;
26 | private final byte id;
27 |
28 | ScreenAction(int id) {
29 | this.id = (byte) id;
30 | }
31 |
32 | public int getId() {
33 | return id;
34 | }
35 |
36 | public static ScreenAction getScreenActionFromId(int id) {
37 | for (ScreenAction action : values()) {
38 | if (action.getId() == id) {
39 | return action;
40 | }
41 | }
42 | return null;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/listener/FakeListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.listener;
21 |
22 | import org.bukkit.entity.Player;
23 |
24 | import org.getspout.spoutapi.packet.standard.MCPacket;
25 |
26 | class FakeListener implements PacketListener {
27 | public Listener listener;
28 |
29 | FakeListener(Listener listener) {
30 | this.listener = listener;
31 | }
32 |
33 | @SuppressWarnings("deprecation")
34 | @Override
35 | public boolean checkPacket(Player player, MCPacket packet) {
36 | Object raw = packet.getPacket();
37 | return listener.checkPacket(player, raw);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/listener/Listener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.listener;
21 |
22 | import org.bukkit.entity.Player;
23 |
24 | public interface Listener {
25 | /**
26 | * @param player The player the packet is sent to
27 | * @param packet The packet to check
28 | * @return false if the packet should be stopped, true otherwise.
29 | */
30 | public boolean checkPacket(Player player, Object packet);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/listener/PacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.listener;
21 |
22 | import org.bukkit.entity.Player;
23 |
24 | import org.getspout.spoutapi.packet.standard.MCPacket;
25 |
26 | public interface PacketListener {
27 | /**
28 | * @param player The player the packet is sent to
29 | * @param packet The packet to check
30 | * @return false if the packet should be stopped, true otherwise.
31 | */
32 | public boolean checkPacket(Player player, MCPacket packet);
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/listener/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interface for packet listening
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacket.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacket {
23 | /**
24 | * @return the packet id of the packet
25 | */
26 | public int getId();
27 |
28 | /**
29 | * @return the raw minecraft packet
30 | */
31 | @Deprecated
32 | public Object getPacket();
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacket0KeepAlive.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacket0KeepAlive extends MCPacket {
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacket17.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacket17 extends MCPacket {
23 | /**
24 | * @return the player's entity id
25 | */
26 | public int getEntityId();
27 |
28 | /**
29 | * @param the player's entity id
30 | */
31 | public void setEntityId(int entityId);
32 |
33 | /**
34 | * 0: Player entered bed?
35 | * @return the bed field
36 | */
37 | public int getBed();
38 |
39 | /**
40 | * @param the bed field
41 | */
42 | public void setBed(int bed);
43 |
44 | public int getBlockX();
45 |
46 | public int getBlockY();
47 |
48 | public int getBlockZ();
49 |
50 | public void setBlockX(int x);
51 |
52 | public void setBlockY(int y);
53 |
54 | public void setBlockZ(int z);
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacket18ArmAnimation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacket18ArmAnimation extends MCPacket {
23 | /**
24 | * @return the player's entity id
25 | */
26 | public int getEntityId();
27 |
28 | /**
29 | * @param the player's entity id
30 | */
31 | public void setEntityId(int entityId);
32 |
33 | /**
34 | * 0: None
35 | * 1: Swing Arm
36 | * 2: Damage
37 | * 3: Leave bed
38 | * 102: ?
39 | * 104: Crouch
40 | * 105: Uncrouch
41 | * @return the animate field
42 | */
43 | public int getAnimate();
44 |
45 | /**
46 | * @param the animate field
47 | */
48 | public void setAnimate(int animate);
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacket3Chat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacket3Chat extends MCPacket {
23 | /**
24 | * @return the chat message
25 | */
26 | public String getMessage();
27 |
28 | /**
29 | * @param message the chat message
30 | */
31 | public void setMessage(String message);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacket51MapChunkUncompressed.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacket51MapChunkUncompressed extends MCPacket51MapChunk {
23 | /**
24 | * The chunk data contains 4 sections
25 | *
26 | * type data: 1 byte per block
27 | * meta data: 1 nibble per block
28 | * block light: 1 nibble per block
29 | * sunlight level: 1 nibble per block
30 | *
31 | * The data in each section can be indexed using
32 | *
33 | * data[x, y, z] = section[y + z*(sizeY + 1) + x*(sizeY + 1)*(sizeZ + 1)
34 | *
35 | * For the last 3 sections, section[] is an array of nibbles.
36 | *
37 | * At least one of the 3 size coordinates is even, which guarantees an even number of nibbles.
38 | * @return uncompressed chunk data
39 | */
40 | public byte[] getUncompressedChunkData();
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/packet/standard/MCPacketUnknown.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.packet.standard;
21 |
22 | public interface MCPacketUnknown extends MCPacket {
23 | /**
24 | * This allows unsupported Minecraft packets to be supported. The Object can be cast to a net.minecraft.server.Packet object.
25 | *
26 | * However, this is only a temporary solution. New packets can be supported as required.
27 | * @return the raw Minecraft Packet
28 | */
29 | public Object getRawPacket();
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/player/EntitySkinType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.player;
21 |
22 | public enum EntitySkinType {
23 | DEFAULT(0),
24 | SPIDER_EYES(1),
25 | SHEEP_FUR(2),
26 | WOLF_ANGRY(3),
27 | WOLF_TAMED(4),
28 | PIG_SADDLE(5),
29 | GHAST_MOUTH(6),
30 | ENDERMAN_EYES(7),;
31 | private final byte id;
32 |
33 | private EntitySkinType(int id) {
34 | this.id = (byte) id;
35 | }
36 |
37 | public byte getId() {
38 | return id;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/player/PlayerChunkMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.player;
21 |
22 | import java.util.UUID;
23 |
24 | import org.bukkit.entity.Entity;
25 | import org.bukkit.entity.Player;
26 |
27 | public interface PlayerChunkMap {
28 | public SpoutPlayer getPlayer(Player player);
29 |
30 | public SpoutPlayer getPlayer(UUID id);
31 |
32 | public SpoutPlayer getPlayer(int entityId);
33 |
34 | public PlayerInformation getPlayerInfo(Player player);
35 |
36 | public PlayerInformation getGlobalInfo();
37 |
38 | public SpoutPlayer[] getOnlinePlayers();
39 |
40 | public void setVersionString(int playerId, String versionString);
41 |
42 | public Entity getEntity(UUID id);
43 |
44 | public Entity getEntity(int entityId);
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/player/PlayerInformation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.player;
21 |
22 | import java.util.Set;
23 |
24 | import org.bukkit.block.Biome;
25 | import org.bukkit.entity.LivingEntity;
26 |
27 | import org.getspout.spoutapi.ClientOnly;
28 | import org.getspout.spoutapi.block.SpoutWeather;
29 |
30 | @SuppressWarnings("deprecation")
31 | public interface PlayerInformation {
32 | @ClientOnly
33 | public SpoutWeather getBiomeWeather(Biome biome);
34 |
35 | @ClientOnly
36 | public void setBiomeWeather(Biome biome, SpoutWeather weather);
37 |
38 | @ClientOnly
39 | public Set getBiomes();
40 |
41 | @ClientOnly
42 | public void setEntitySkin(LivingEntity entity, String url);
43 |
44 | @ClientOnly
45 | public void setEntitySkin(LivingEntity entity, String url, EntitySkinType type);
46 |
47 | @ClientOnly
48 | public String getEntitySkin(LivingEntity entity, EntitySkinType type);
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/player/RenderDistance.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.player;
21 |
22 | public enum RenderDistance {
23 | FAR(0),
24 | NORMAL(1),
25 | SHORT(2),
26 | TINY(3);
27 | private final int value;
28 |
29 | RenderDistance(final int i) {
30 | value = i;
31 | }
32 |
33 | public final int getValue() {
34 | return value;
35 | }
36 |
37 | public static RenderDistance getRenderDistanceFromValue(int value) {
38 | for (RenderDistance rd : values()) {
39 | if (rd.getValue() == value) {
40 | return rd;
41 | }
42 | }
43 | return null;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/player/accessories/AccessoryType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.player.accessories;
21 |
22 | import java.util.HashMap;
23 | import java.util.Map;
24 |
25 | public enum AccessoryType {
26 | TOPHAT(1),
27 | NOTCHHAT(2),
28 | BRACELET(3),
29 | WINGS(4),
30 | EARS(5),
31 | SUNGLASSES(6),
32 | TAIL(7);
33 | private final int id;
34 | private static Map types = new HashMap();
35 |
36 | static {
37 | for (AccessoryType type : AccessoryType.values()) {
38 | types.put(type.getId(), type);
39 | }
40 | }
41 |
42 | private AccessoryType(int id) {
43 | this.id = id;
44 | }
45 |
46 | public int getId() {
47 | return id;
48 | }
49 |
50 | public static AccessoryType get(int id) {
51 | return types.get(id);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/player/package.html:
--------------------------------------------------------------------------------
1 |
22 |
43 |
44 |
45 |
46 |
47 | This package provides the interfaces for player and related managers
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/plugin/SpoutPlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.plugin;
21 |
22 | import java.util.logging.Logger;
23 |
24 | import org.bukkit.event.Listener;
25 | import org.bukkit.plugin.java.JavaPlugin;
26 |
27 | import org.getspout.spoutapi.Spout;
28 | import org.getspout.spoutapi.SpoutManager;
29 | import org.getspout.spoutapi.SpoutServer;
30 |
31 | @Deprecated
32 | public abstract class SpoutPlugin extends JavaPlugin {
33 | public SpoutServer getSpoutServer() {
34 | return Spout.getServer();
35 | }
36 |
37 | public SpoutManager getSpoutManager() {
38 | return SpoutManager.getInstance();
39 | }
40 |
41 | public void registerEvents(Listener listener) {
42 | getSpoutServer().getPluginManager().registerEvents(listener, this);
43 | }
44 |
45 | public String getVersion() {
46 | return getDescription().getVersion();
47 | }
48 |
49 | public void log(String s) {
50 | getLogger().info(String.format("[%s] %s", getName(), s));
51 | }
52 |
53 | public void log(String s, String... args) {
54 | getLogger().info(String.format("[%s] %s", getName(), String.format(s, (Object[]) args)));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/getspout/spoutapi/util/map/TByteShortByteKeyedMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SpoutcraftPlugin.
3 | *
4 | * Copyright (c) 2011 SpoutcraftDev
5 | * SpoutcraftPlugin is licensed under the GNU Lesser General Public License.
6 | *
7 | * SpoutcraftPlugin is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * SpoutcraftPlugin is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 | package org.getspout.spoutapi.util.map;
21 |
22 | /**
23 | * A simplistic map that supports (byte, short, byte) keys, using a trove int * hashmap in the backend.
24 | *
25 | */
26 | public class TByteShortByteKeyedMap {
27 | public static final int key(int x, int y, int z) {
28 | return ((x & 0xFF) << 24) | ((z & 0xFF) << 16) | (y & 0xFFFF);
29 | }
30 |
31 | public static byte getXFromKey(int key) {
32 | return (byte)(key >> 24);
33 | }
34 |
35 | public static short getYFromKey(int key) {
36 | return (short)key;
37 | }
38 |
39 | public static byte getZFromKey(int key) {
40 | return (byte)(key >> 16);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/resources/config.yml:
--------------------------------------------------------------------------------
1 | ForceClientKickMessage: This server requires Spoutcraft! http://get.spout.org
2 | ServerVersionCheck: true
3 | ClientCheckTicks: 200
4 | ChunkDataCache: true
5 | AllowClientCache: true
6 | waypoints:
7 | world:
8 | Spawn:
9 | x: 0
10 | y: 64
11 | z: 0
12 | world_nether:
13 | Spawn:
14 | x: 0
15 | y: 64.5
16 | z: 0
17 |
--------------------------------------------------------------------------------