mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 06:28:49 +00:00
Add Sponge (API v8) server mod support (#354)
This commit is contained in:
1 parent
059fc638c6
commit
be43fbc345
35 files changed
+2603
-9
No files matched your search
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import net.william278.huskhomes.user.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeDeleteAllHomesEvent implements IDeleteAllHomesEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final User user;
|
||||
private final CommandUser deleter;
|
||||
|
||||
public SpongeDeleteAllHomesEvent(@NotNull User user, @NotNull CommandUser deleter) {
|
||||
this.user = user;
|
||||
this.deleter = deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public User getHomeOwner() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getDeleter() {
|
||||
return deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(deleter)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeDeleteAllWarpsEvent implements IDeleteAllWarpsEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final CommandUser deleter;
|
||||
|
||||
public SpongeDeleteAllWarpsEvent(@NotNull CommandUser deleter) {
|
||||
this.deleter = deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getDeleter() {
|
||||
return deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(deleter)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.SpongeHuskHomes;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.Position;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.teleport.Teleport;
|
||||
import net.william278.huskhomes.teleport.TeleportRequest;
|
||||
import net.william278.huskhomes.teleport.TimedTeleport;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import net.william278.huskhomes.user.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SpongeEventDispatcher extends EventDispatcher {
|
||||
|
||||
@Override
|
||||
default <T extends net.william278.huskhomes.event.Event> boolean fireIsCancelled(@NotNull T event) {
|
||||
return getPlugin().getGame().eventManager().post((Event) event);
|
||||
}
|
||||
|
||||
@Override
|
||||
default ITeleportEvent getTeleportEvent(@NotNull Teleport teleport) {
|
||||
return new SpongeTeleportEvent(teleport);
|
||||
}
|
||||
|
||||
@Override
|
||||
default ITeleportWarmupEvent getTeleportWarmupEvent(@NotNull TimedTeleport teleport, int duration) {
|
||||
return new SpongeTeleportWarmupEvent(teleport, duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
default ISendTeleportRequestEvent getSendTeleportRequestEvent(@NotNull OnlineUser sender, @NotNull TeleportRequest request) {
|
||||
return new SpongeSendTeleportRequestEvent(sender, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IReceiveTeleportRequestEvent getReceiveTeleportRequestEvent(@NotNull OnlineUser recipient, @NotNull TeleportRequest request) {
|
||||
return new SpongeReceiveTeleportRequestEvent(recipient, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IReplyTeleportRequestEvent getReplyTeleportRequestEvent(@NotNull OnlineUser recipient, @NotNull TeleportRequest request) {
|
||||
return new SpongeReplyTeleportRequestEvent(recipient, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IHomeCreateEvent getHomeCreateEvent(@NotNull User owner, @NotNull String name, @NotNull Position position, @NotNull CommandUser creator) {
|
||||
return new SpongeHomeCreateEvent(owner, name, position, creator);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IHomeEditEvent getHomeEditEvent(@NotNull Home home, @NotNull CommandUser editor) {
|
||||
return new SpongeHomeEditEvent(home, editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IHomeDeleteEvent getHomeDeleteEvent(@NotNull Home home, @NotNull CommandUser deleter) {
|
||||
return new SpongeHomeDeleteEvent(home, deleter);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IWarpCreateEvent getWarpCreateEvent(@NotNull String name, @NotNull Position position, @NotNull CommandUser creator) {
|
||||
return new SpongeWarpCreateEvent(name, position, creator);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IWarpEditEvent getWarpEditEvent(@NotNull Warp warp, @NotNull CommandUser editor) {
|
||||
return new SpongeWarpEditEvent(warp, editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IWarpDeleteEvent getWarpDeleteEvent(@NotNull Warp warp, @NotNull CommandUser deleter) {
|
||||
return new SpongeWarpDeleteEvent(warp, deleter);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IHomeListEvent getViewHomeListEvent(@NotNull List<Home> homes, @NotNull CommandUser listViewer, boolean publicHomeList) {
|
||||
return new SpongeHomeListEvent(homes, listViewer, publicHomeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IWarpListEvent getViewWarpListEvent(@NotNull List<Warp> homes, @NotNull CommandUser listViewer) {
|
||||
return new SpongeWarpListEvent(homes, listViewer);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IDeleteAllHomesEvent getDeleteAllHomesEvent(@NotNull User user, @NotNull CommandUser deleter) {
|
||||
return new SpongeDeleteAllHomesEvent(user, deleter);
|
||||
}
|
||||
|
||||
@Override
|
||||
default IDeleteAllWarpsEvent getDeleteAllWarpsEvent(@NotNull CommandUser deleter) {
|
||||
return new SpongeDeleteAllWarpsEvent(deleter);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
SpongeHuskHomes getPlugin();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Position;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import net.william278.huskhomes.user.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeHomeCreateEvent implements IHomeCreateEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final User owner;
|
||||
private String name;
|
||||
private Position position;
|
||||
private final CommandUser creator;
|
||||
|
||||
public SpongeHomeCreateEvent(@NotNull User owner, @NotNull String name, @NotNull Position position, @NotNull CommandUser creator) {
|
||||
this.owner = owner;
|
||||
this.name = name;
|
||||
this.position = position;
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public User getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(@NotNull String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(@NotNull Position position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(creator)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeHomeDeleteEvent implements IHomeDeleteEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final Home home;
|
||||
private final CommandUser deleter;
|
||||
|
||||
public SpongeHomeDeleteEvent(@NotNull Home home, @NotNull CommandUser deleter) {
|
||||
this.home = home;
|
||||
this.deleter = deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Home getHome() {
|
||||
return home;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getDeleter() {
|
||||
return deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(deleter)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeHomeEditEvent implements IHomeEditEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final Home home;
|
||||
private final CommandUser editor;
|
||||
|
||||
public SpongeHomeEditEvent(@NotNull Home home, @NotNull CommandUser editor) {
|
||||
this.home = home;
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Home getHome() {
|
||||
return home;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getEditor() {
|
||||
return editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(editor)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SpongeHomeListEvent implements IHomeListEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private List<Home> homes;
|
||||
private final CommandUser listViewer;
|
||||
private final boolean publicHomeList;
|
||||
|
||||
public SpongeHomeListEvent(@NotNull List<Home> homes, @NotNull CommandUser listViewer, boolean publicHomeList) {
|
||||
this.homes = homes;
|
||||
this.listViewer = listViewer;
|
||||
this.publicHomeList = publicHomeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Home> getHomes() {
|
||||
return homes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHomes(@NotNull List<Home> homes) {
|
||||
this.homes = homes;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getListViewer() {
|
||||
return listViewer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsPublicHomeList() {
|
||||
return publicHomeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(listViewer)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.teleport.TeleportRequest;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeReceiveTeleportRequestEvent implements IReceiveTeleportRequestEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final OnlineUser recipient;
|
||||
private final TeleportRequest request;
|
||||
|
||||
public SpongeReceiveTeleportRequestEvent(@NotNull OnlineUser recipient, @NotNull TeleportRequest request) {
|
||||
this.recipient = recipient;
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OnlineUser getRecipient() {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TeleportRequest getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(recipient)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.teleport.TeleportRequest;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeReplyTeleportRequestEvent implements IReplyTeleportRequestEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final OnlineUser recipient;
|
||||
private final TeleportRequest request;
|
||||
|
||||
public SpongeReplyTeleportRequestEvent(@NotNull OnlineUser recipient, @NotNull TeleportRequest request) {
|
||||
this.recipient = recipient;
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OnlineUser getRecipient() {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TeleportRequest getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(recipient)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.teleport.TeleportRequest;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeSendTeleportRequestEvent implements ISendTeleportRequestEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final OnlineUser sender;
|
||||
private final TeleportRequest request;
|
||||
|
||||
public SpongeSendTeleportRequestEvent(@NotNull OnlineUser sender, @NotNull TeleportRequest request) {
|
||||
this.sender = sender;
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OnlineUser getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TeleportRequest getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(sender)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.teleport.Teleport;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeTeleportEvent implements ITeleportEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final Teleport teleport;
|
||||
|
||||
public SpongeTeleportEvent(@NotNull Teleport teleport) {
|
||||
this.teleport = teleport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Teleport getTeleport() {
|
||||
return teleport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(teleport.getTeleporter())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.teleport.TimedTeleport;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeTeleportWarmupEvent implements ITeleportWarmupEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final TimedTeleport teleport;
|
||||
private final int duration;
|
||||
|
||||
public SpongeTeleportWarmupEvent(@NotNull TimedTeleport teleport, int duration) {
|
||||
this.teleport = teleport;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(teleport.getTeleporter())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarmupDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TimedTeleport getTimedTeleport() {
|
||||
return teleport;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Position;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeWarpCreateEvent implements IWarpCreateEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private String name;
|
||||
private Position position;
|
||||
private final CommandUser creator;
|
||||
|
||||
public SpongeWarpCreateEvent(@NotNull String name, @NotNull Position position, @NotNull CommandUser creator) {
|
||||
this.name = name;
|
||||
this.position = position;
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(@NotNull String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(@NotNull Position position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(creator)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeWarpDeleteEvent implements IWarpDeleteEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final Warp warp;
|
||||
private final CommandUser deleter;
|
||||
|
||||
public SpongeWarpDeleteEvent(@NotNull Warp warp, @NotNull CommandUser deleter) {
|
||||
this.warp = warp;
|
||||
this.deleter = deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Warp getWarp() {
|
||||
return warp;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getDeleter() {
|
||||
return deleter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(deleter)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
public class SpongeWarpEditEvent implements IWarpEditEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private final Warp warp;
|
||||
private final CommandUser editor;
|
||||
|
||||
public SpongeWarpEditEvent(@NotNull Warp warp, @NotNull CommandUser editor) {
|
||||
this.warp = warp;
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Warp getWarp() {
|
||||
return warp;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getEditor() {
|
||||
return editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(editor)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of HuskHomes, licensed under the Apache License 2.0.
|
||||
*
|
||||
* Copyright (c) William278 <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.Event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SpongeWarpListEvent implements IWarpListEvent, Event, Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
private List<Warp> warps;
|
||||
private final CommandUser listViewer;
|
||||
|
||||
public SpongeWarpListEvent(@NotNull List<Warp> warps, @NotNull CommandUser listViewer) {
|
||||
this.warps = warps;
|
||||
this.listViewer = listViewer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Warp> getWarps() {
|
||||
return warps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWarps(@NotNull List<Warp> warps) {
|
||||
this.warps = warps;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CommandUser getListViewer() {
|
||||
return listViewer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cause cause() {
|
||||
return Cause.builder()
|
||||
.append(listViewer)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user